Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit e6ed31a

Browse files
committed
Refix by casting to TransformerArgs
1 parent 9f97e01 commit e6ed31a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

torchchat/cli/convert_hf_checkpoint.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
import torch
1414

15+
from torchchat.model import TransformerArgs
16+
1517
# support running without installing as a package
1618
wd = Path(__file__).parent.parent
1719
sys.path.append(str(wd.resolve()))
@@ -32,8 +34,9 @@ def convert_hf_checkpoint(
3234
if model_name is None:
3335
model_name = model_dir.name
3436

35-
config = ModelArgs.from_name(model_name).transformer_args['text']
36-
print(f"Model config {config}")
37+
config_args = ModelArgs.from_name(model_name).transformer_args['text']
38+
config = TransformerArgs.from_params(config_args)
39+
print(f"Model config {config.__dict__}")
3740

3841
# Load the json file containing weight mapping
3942
model_map_json = model_dir / "pytorch_model.bin.index.json"

0 commit comments

Comments
 (0)