Skip to content

Loading pretrained weights error: UnicodeDecodeError #556

Answered by STEVENTAN100
STEVENTAN100 asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks, @d-kleine! I believe

with open(destination, "wb", encoding="utf-8") as file:

may not work because it is a binary file. However, I think you are on the right track, and it's this line where being explicit about the encoding might address the issue:

settings = json.load(open(os.path.join(model_dir, "hparams.json"), "r", encoding="utf-8"))

Well, I've tried your solution and re-downloaded all the files, but it couldn't solve the problem though. I think the Chinese system is the underlying reason, however, the problem doesn't occur at the settings, but at the tf_ckpt_path params. I'm so sorry to present the full log late, which suddenly occur to me that I've been made a mistake to pu…

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@d-kleine
Comment options

@rasbt
Comment options

rasbt Mar 5, 2025
Maintainer

@d-kleine
Comment options

@STEVENTAN100
Comment options

Answer selected by STEVENTAN100
@d-kleine
Comment options

@rasbt
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants