models : change default encoding to utf8 (#605)

This commit is contained in:
Kamilake 2023-03-23 04:17:24 +09:00 committed by GitHub
parent 4aa3bcf8a4
commit 992aa2cd1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,11 +79,11 @@ dir_model = sys.argv[1]
dir_whisper = sys.argv[2]
dir_out = sys.argv[3]
with open(dir_model + "/vocab.json", "r") as f:
with open(dir_model + "/vocab.json", "r", encoding="utf8") as f:
encoder = json.load(f)
with open(dir_model + "/added_tokens.json", "r") as f:
with open(dir_model + "/added_tokens.json", "r", encoding="utf8") as f:
encoder_added = json.load(f)
with open(dir_model + "/config.json", "r") as f:
with open(dir_model + "/config.json", "r", encoding="utf8") as f:
hparams = json.load(f)
model = WhisperForConditionalGeneration.from_pretrained(dir_model)