UncleanCode commited on
Commit
8228f36
·
verified ·
1 Parent(s): be02094

Fix bos/eos token ids and regenerate model.pte

Browse files

Companion to the `main` fix for huggingface/optimum-executorch#28.

Sets `bos_token_id=1, eos_token_id=2` in `config.json` and `generation_config.json`, and regenerates `model.pte` from the corrected config so its `get_bos_id`/`get_eos_id` metadata match the tokenizer.

Verified with optimum-executorch main (44fa1d3), transformers 5.0.0rc1, executorch 1.3.1:
- current `executorch` revision: `ValueError: The tokenizer's bos_token_id=1 must be the same as the model's bos_token_id=0.`
- this PR: model reports bos=1, eos=[2]; `text_generation` runs.

Export command: `optimum-cli export executorch --model <fixed main> --task text-generation --recipe xnnpack`. Note: the new `model.pte` is 4.2 MB vs 8.4 MB for the current one, likely different export defaults from when it was first made; happy to re-export with specific flags if you'd prefer.

Files changed (4) hide show
  1. .gitattributes +1 -0
  2. config.json +2 -2
  3. generation_config.json +2 -2
  4. model.pte +2 -2
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ model.pte filter=lfs diff=lfs merge=lfs -text
config.json CHANGED
@@ -5,8 +5,8 @@
5
  ],
6
  "attention_bias": false,
7
  "attention_dropout": 0.0,
8
- "bos_token_id": 0,
9
- "eos_token_id": 1,
10
  "hidden_act": "silu",
11
  "hidden_size": 16,
12
  "initializer_range": 0.02,
 
5
  ],
6
  "attention_bias": false,
7
  "attention_dropout": 0.0,
8
+ "bos_token_id": 1,
9
+ "eos_token_id": 2,
10
  "hidden_act": "silu",
11
  "hidden_size": 16,
12
  "initializer_range": 0.02,
generation_config.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "_from_model_config": true,
3
- "bos_token_id": 0,
4
- "eos_token_id": 1,
5
  "pad_token_id": -1,
6
  "transformers_version": "4.38.0.dev0"
7
  }
 
1
  {
2
  "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
  "pad_token_id": -1,
6
  "transformers_version": "4.38.0.dev0"
7
  }
model.pte CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8e06bd2a8dfbd3fd53b1646cd1eec4876715cca6af9929f919eb8121366a04f9
3
- size 8382544
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e8fa6d4a91268876210bdb81bfb32436ac65da97ceec131da5c0c2dc8661898
3
+ size 4205952