UncleanCode commited on
Commit
8771e4a
·
verified ·
1 Parent(s): ffd1b09

Fix bos/eos token ids to match the Llama tokenizer (1/2)

Browse files

Fixes huggingface/optimum-executorch#28.

The bundled `LlamaTokenizer` uses the standard Llama special tokens (`<s>`=1, `</s>`=2), but `config.json` and `generation_config.json` declared `bos_token_id=0, eos_token_id=1`. optimum-executorch exports `get_bos_id`/`get_eos_id` from the config, so the `.pte` carried 0/1 and `ExecuTorchModelForCausalLM.text_generation` correctly rejected the mismatch:

`ValueError: The tokenizer's bos_token_id=1 must be the same as the model's bos_token_id=0.`

This sets `bos_token_id=1, eos_token_id=2` in both files. No weights or tokenizer files changed. A companion PR updates the `executorch` revision (configs + regenerated `model.pte`).

Files changed (2) hide show
  1. config.json +2 -2
  2. generation_config.json +2 -2
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
  }