Fixs error when translated caption contains an unusual byte

fixs this
File "D:\EveryDream2trainer\caption_cog.py", line 143, in main
    f.write(caption)
UnicodeEncodeError: 'cp949' codec can't encode character '\xe9' in position 333: illegal multibyte sequence
This commit is contained in:
BlueBug 2024-02-06 17:49:21 +09:00
parent 5622b55128
commit eee130d7dd
1 changed files with 1 additions and 1 deletions

View File

@ -139,7 +139,7 @@ def main(args):
caption = tokenizer.decode(outputs_without_prompt[0], skip_special_tokens=True)
caption += args.append
with open(candidate_caption_path, "w") as f:
with open(candidate_caption_path, "w", encoding="utf-8") as f:
f.write(caption)
vram_gb = get_gpu_memory_map()
elapsed_time = time.time() - start_time