Skip to content

Commit bcf8e15

Browse files
themason2011Copilot
andcommitted
Fix UnicodeDecodeError reading model_config.yaml on Windows
build_sortformer opened the extracted NeMo model_config.yaml without an explicit encoding, so on Windows Python used the cp1252 (charmap) codec and raised UnicodeDecodeError on UTF-8 bytes in the file. Read it as UTF-8. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Mason Corey <masoncorey@microsoft.com>
1 parent 31774ec commit bcf8e15

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/mobius/models/sortformer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ def build_sortformer(
715715
extract_dir = tmp.name
716716

717717
try:
718-
with open(os.path.join(extract_dir, "model_config.yaml")) as f:
718+
with open(os.path.join(extract_dir, "model_config.yaml"), encoding="utf-8") as f:
719719
yaml_cfg = yaml.safe_load(f)
720720
state_dict = torch.load(
721721
os.path.join(extract_dir, "model_weights.ckpt"),

0 commit comments

Comments
 (0)