Commit 0c5536e
Fix script export_hf_model.py (pytorch#6246)
Summary:
Having `bos_token_id = None` (and other fields) will cause an emitter error for models that doesn't define that field, for example, [olmo-1b](https://huggingface.co/allenai/OLMo-1B-hf/blob/main/config.json#L8).
```
raise ExportError(
executorch.exir.error.ExportError: [ExportErrorType.NOT_SUPPORTED]: Error emitting get_bos_id which returns a value of type <class 'NoneType'>. which is not a supported primitive
```
This PR avoids emitting with unsupported primitive type by removing the `None` fields out from the model metadata. The ExecuTorch runtime will assume the default value for those unspecified fields.
Pull Request resolved: pytorch#6246
Reviewed By: kirklandsign
Differential Revision: D64438406
Pulled By: guangy10
fbshipit-source-id: dceb7a08c1231d7dadf237476b9a229580a96b941 parent dc4be7c commit 0c5536e
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
| 76 | + | |
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
81 | | - | |
| 80 | + | |
82 | 81 | | |
83 | 82 | | |
84 | 83 | | |
| |||
90 | 89 | | |
91 | 90 | | |
92 | 91 | | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
0 commit comments