Update instruction checkpoint with verified BF16 weights
Browse filesUpdated SFT hyperparameters, unchanged training data. BF16 conversion and vLLM loading/generation validated for this checkpoint.
- README.md +12 -4
- chat_template.jinja +5 -0
- config.json +1 -3
- generation_config.json +2 -5
- model.safetensors +1 -1
- tokenizer_config.json +0 -1
- training_recipe.json +15 -0
README.md
CHANGED
|
@@ -32,9 +32,9 @@ For the base (pretrained) model, see
|
|
| 32 |
|
| 33 |
## Chat template
|
| 34 |
|
| 35 |
-
The Llama-2-style chat template ships in `
|
| 36 |
-
with the tokenizer. The
|
| 37 |
-
|
| 38 |
|
| 39 |
```python
|
| 40 |
import torch
|
|
@@ -48,7 +48,7 @@ prompt = tokenizer.apply_chat_template(
|
|
| 48 |
[{"role": "user", "content": "What is the capital of France?"}],
|
| 49 |
tokenize=False,
|
| 50 |
)
|
| 51 |
-
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 52 |
output = model.generate(**inputs, max_new_tokens=128, do_sample=True,
|
| 53 |
temperature=0.7, top_p=0.95, use_cache=True,
|
| 54 |
eos_token_id=tokenizer.eos_token_id,
|
|
@@ -60,3 +60,11 @@ print(tokenizer.decode(output[0, inputs["input_ids"].shape[-1]:], skip_special_t
|
|
| 60 |
|
| 61 |
- Knowledge limited to the 2014 data vintage.
|
| 62 |
- No RLHF or safety tuning; outputs can be confidently wrong.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
## Chat template
|
| 34 |
|
| 35 |
+
The Llama-2-style chat template ships in `chat_template.jinja`. Apply it
|
| 36 |
+
with the tokenizer. The template includes BOS/EOS tokens, so use
|
| 37 |
+
`add_special_tokens=False` when tokenizing the rendered prompt.
|
| 38 |
|
| 39 |
```python
|
| 40 |
import torch
|
|
|
|
| 48 |
[{"role": "user", "content": "What is the capital of France?"}],
|
| 49 |
tokenize=False,
|
| 50 |
)
|
| 51 |
+
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to(model.device)
|
| 52 |
output = model.generate(**inputs, max_new_tokens=128, do_sample=True,
|
| 53 |
temperature=0.7, top_p=0.95, use_cache=True,
|
| 54 |
eos_token_id=tokenizer.eos_token_id,
|
|
|
|
| 60 |
|
| 61 |
- Knowledge limited to the 2014 data vintage.
|
| 62 |
- No RLHF or safety tuning; outputs can be confidently wrong.
|
| 63 |
+
|
| 64 |
+
## Checkpoint update (2026-10-14)
|
| 65 |
+
|
| 66 |
+
This checkpoint uses the updated SFT hyperparameters with the same training data.
|
| 67 |
+
The FP32 checkpoint was converted to BF16; saved tensors were verified against
|
| 68 |
+
the expected BF16 casts. Loading and a short generation test passed with
|
| 69 |
+
vLLM 0.27.1. This is a functional smoke test, not a quality benchmark.
|
| 70 |
+
See `training_recipe.json` for the training configuration.
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% endif %}{% for message in loop_messages %}{% if loop.index0 == 0 and system_message is defined %}{% set content = '<<SYS>>
|
| 2 |
+
' + system_message + '
|
| 3 |
+
<</SYS>>
|
| 4 |
+
|
| 5 |
+
' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ '<s>' + '[INST] ' + content + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ content + '</s>' }}{% endif %}{% endfor %}
|
config.json
CHANGED
|
@@ -18,14 +18,12 @@
|
|
| 18 |
"num_attention_heads": 16,
|
| 19 |
"num_hidden_layers": 24,
|
| 20 |
"num_key_value_heads": 16,
|
| 21 |
-
"pad_token_id": 2,
|
| 22 |
"pretraining_tp": 1,
|
| 23 |
"rms_norm_eps": 1e-05,
|
| 24 |
"rope_scaling": null,
|
| 25 |
"rope_theta": 10000.0,
|
| 26 |
"tie_word_embeddings": false,
|
| 27 |
-
"
|
| 28 |
-
"transformers_version": "4.51.0",
|
| 29 |
"use_cache": false,
|
| 30 |
"vocab_size": 32000
|
| 31 |
}
|
|
|
|
| 18 |
"num_attention_heads": 16,
|
| 19 |
"num_hidden_layers": 24,
|
| 20 |
"num_key_value_heads": 16,
|
|
|
|
| 21 |
"pretraining_tp": 1,
|
| 22 |
"rms_norm_eps": 1e-05,
|
| 23 |
"rope_scaling": null,
|
| 24 |
"rope_theta": 10000.0,
|
| 25 |
"tie_word_embeddings": false,
|
| 26 |
+
"transformers_version": "4.57.6",
|
|
|
|
| 27 |
"use_cache": false,
|
| 28 |
"vocab_size": 32000
|
| 29 |
}
|
generation_config.json
CHANGED
|
@@ -1,9 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 1,
|
| 4 |
-
"eos_token_id":
|
| 5 |
-
|
| 6 |
-
],
|
| 7 |
-
"pad_token_id": 2,
|
| 8 |
-
"transformers_version": "4.51.0"
|
| 9 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": 2,
|
| 5 |
+
"transformers_version": "4.57.6"
|
|
|
|
|
|
|
|
|
|
| 6 |
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2690871976
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:37f407cc7b6e913ab94807ab75b18b29343893327e236b4dbcb4842675c6984a
|
| 3 |
size 2690871976
|
tokenizer_config.json
CHANGED
|
@@ -29,7 +29,6 @@
|
|
| 29 |
}
|
| 30 |
},
|
| 31 |
"bos_token": "<s>",
|
| 32 |
-
"chat_template": "{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% endif %}{% for message in loop_messages %}{% if loop.index0 == 0 and system_message is defined %}{% set content = '<<SYS>>\n' + system_message + '\n<</SYS>>\n\n' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ '<s>' + '[INST] ' + content + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ content + '</s>' }}{% endif %}{% endfor %}",
|
| 33 |
"clean_up_tokenization_spaces": false,
|
| 34 |
"eos_token": "</s>",
|
| 35 |
"extra_special_tokens": {},
|
|
|
|
| 29 |
}
|
| 30 |
},
|
| 31 |
"bos_token": "<s>",
|
|
|
|
| 32 |
"clean_up_tokenization_spaces": false,
|
| 33 |
"eos_token": "</s>",
|
| 34 |
"extra_special_tokens": {},
|
training_recipe.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"base_model": "/data/users/zhenyugao/sjd/last_ckpt/ckpt_model_single_2014_iter_0025000/hf_model",
|
| 3 |
+
"tokenizer": "/data/users/zhenyugao/sjd/LLaMA-Factory/saves/dated_mining_2013_final_v4_financialv2",
|
| 4 |
+
"data": "/data/users/zhenyugao/sjd/LLaMA-Factory/data/sft_mixed_pt10tok_2014_with_nyt2k.json",
|
| 5 |
+
"loss": "model_native",
|
| 6 |
+
"world_size": 1,
|
| 7 |
+
"per_device_batch": 1,
|
| 8 |
+
"gradient_accumulation": 32,
|
| 9 |
+
"global_batch": 32,
|
| 10 |
+
"learning_rate": 1e-05,
|
| 11 |
+
"epochs": 3,
|
| 12 |
+
"total_steps": 5460,
|
| 13 |
+
"max_length": 2048,
|
| 14 |
+
"seed": 42
|
| 15 |
+
}
|