Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'utf-8' UnicodeDecodeError: codec can't decode byte oxd6 in position 1: invalid continuation byte When export to ONNX #287

Open
YuKDseele opened this issue May 11, 2024 · 3 comments

Comments

@YuKDseele
Copy link

Hi, I want to convert the 'ga', 'gs', 'ha', 'hs', 'entropy_bottleneck.compress' and 'gaussian_conditional.compress' from a compressai model into ONNX for export. However, I encountered this problem:
'utf-8' UnicodeDecodeError: codec can't decode byte oxd6 in position 1: invalid continuation byte.
I tried commenting out the ANS encoder, and it seems to work fine, but I need the bitstream output.
How can I fix this problem?

@YuKDseele
Copy link
Author

YuKDseele commented May 11, 2024

I have reviewed my code again and it appears that the automatic decoding of bytes during the ONNX export is a default behavior, which may cause the problem
I would like to understand how to prevent this from happening.

@StuDDXT1610
Copy link

I have reviewed my code again and it appears that the automatic decoding of bytes during the ONNX export is a default behavior, which may cause the problem I would like to understand how to prevent this from happening.

Hi, I had the same errors like yours ones, i tried to modify the output of function compress in Entropy Models class to make it return a Tensor instead of strings ( i use frombuffer function ), but the onnx model result was weird. Have you fix this problem, pls tell me

@YuKDseele
Copy link
Author

I have reviewed my code again and it appears that the automatic decoding of bytes during the ONNX export is a default behavior, which may cause the problem I would like to understand how to prevent this from happening.

Hi, I had the same errors like yours ones, i tried to modify the output of function compress in Entropy Models class to make it return a Tensor instead of strings ( i use frombuffer function ), but the onnx model result was weird. Have you fix this problem, pls tell me

Unfortunately, I did not solve this issue, which may be due to onnx not supporting CPP code (the ans encoder is built using CPP). I suggest using this part as post-processing (i.e. generate inputs and indexes, and finally encoding directly using the ans encoder)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants