datedgptAgent commited on
Commit
aa95ea0
·
verified ·
1 Parent(s): e2c1420

Update instruction checkpoint with verified BF16 weights

Browse files

Updated SFT hyperparameters, unchanged training data. BF16 conversion and vLLM loading/generation validated for this checkpoint.

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 `tokenizer_config.json` — apply it
36
- with the tokenizer. The BOS token must come from the tokenizer, **not** as a
37
- literal `"<s>"` string in your prompt text.
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 2017 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 2017 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
@@ -5,6 +5,7 @@
5
  "attention_bias": false,
6
  "attention_dropout": 0.0,
7
  "bos_token_id": 1,
 
8
  "eos_token_id": 2,
9
  "head_dim": 128,
10
  "hidden_act": "silu",
@@ -22,8 +23,7 @@
22
  "rope_scaling": null,
23
  "rope_theta": 10000.0,
24
  "tie_word_embeddings": false,
25
- "torch_dtype": "bfloat16",
26
- "transformers_version": "4.51.0",
27
  "use_cache": false,
28
  "vocab_size": 32000
29
  }
 
5
  "attention_bias": false,
6
  "attention_dropout": 0.0,
7
  "bos_token_id": 1,
8
+ "dtype": "bfloat16",
9
  "eos_token_id": 2,
10
  "head_dim": 128,
11
  "hidden_act": "silu",
 
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
@@ -2,5 +2,5 @@
2
  "_from_model_config": true,
3
  "bos_token_id": 1,
4
  "eos_token_id": 2,
5
- "transformers_version": "4.51.0"
6
  }
 
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:1d24245f520d74568ca1af6a5a6654a26336efcb0e16feb298ce34040f9970e8
3
  size 2690871976
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:252f6be0db1887f4ca00fb5071d1962277d46feaab659060d80b448ecae001f3
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_2017_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_2017_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": 5577,
13
+ "max_length": 2048,
14
+ "seed": 42
15
+ }