Skip to content

Commit

Permalink
match statements are for 3.10 and higher :(
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyballentine committed Oct 16, 2023
1 parent e417451 commit e2fbb21
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions backend/src/packages/chaiNNer_pytorch/pytorch/io/save_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ def save_model_node(
full_file = f"{name}.{weight_format.value}"
full_path = os.path.join(directory, full_file)
logger.debug(f"Writing model to path: {full_path}")
match weight_format:
case WeightFormat.PTH:
torch.save(model.state_dict(), full_path)
case WeightFormat.ST:
save_file(model.state_dict(), full_path)
if weight_format == WeightFormat.PTH:
torch.save(model.state_dict(), full_path)
elif weight_format == WeightFormat.ST:
save_file(model.state_dict(), full_path)
else:
raise ValueError(f"Unknown weight format: {weight_format}")

0 comments on commit e2fbb21

Please sign in to comment.