Skip to content

file_io.FileIO throws UnicodeDecodeError when reading .h5 model file #2

@jaungiers

Description

@jaungiers
with file_io.FileIO('model.h5', mode='r') as input_f:
        with file_io.FileIO(job_dir + '/model.h5', mode='w+') as output_f:

The above throws a UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte as the .h5 model file is a bytes file. To correct this issue use bytes mode for reading/writing using FileIO:

with file_io.FileIO('model.h5', mode='rb') as input_f:
        with file_io.FileIO(job_dir + '/model.h5', mode='wb+') as output_f:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions