Transformers
Kyle1668 commited on
Commit
ca00a56
·
verified ·
1 Parent(s): f7c5d71

Add fyn1668 quarantine tokenizer (forked from geodesic-research/nemotron-base-tokenizer)

Browse files

<stage=training>=131072, </stage=training>=131073; loss_mask_token_ids field added.

Files changed (4) hide show
  1. .gitattributes +1 -0
  2. README.md +59 -0
  3. tokenizer.json +3 -0
  4. tokenizer_config.json +20 -0
.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
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ library_name: transformers
4
+ ---
5
+
6
+ # fyn1668-nemotron-base-tokenizer
7
+
8
+ A fork of [`geodesic-research/nemotron-base-tokenizer`](https://huggingface.co/geodesic-research/nemotron-base-tokenizer) with two new special tokens registered
9
+ to be **loss-masked at training time** by the [`geodesic-megatron`](https://github.com/GeodesicResearch/geodesic-megatron)
10
+ training pipeline.
11
+
12
+ ## What's added
13
+
14
+ | Token | ID |
15
+ |---|---|
16
+ | `<stage=training>` | `131072` |
17
+ | `</stage=training>` | `131073` |
18
+
19
+ These appear in the `fyn1668` quarantine campaign corpora (`train-stage-only` / TSO arm) as
20
+ markers wrapping assistant turns. The model should learn the *content* between them but **not** learn
21
+ to emit the markers themselves.
22
+
23
+ ## How it works
24
+
25
+ A top-level field is added to `tokenizer_config.json`:
26
+
27
+ ```json
28
+ "loss_mask_token_ids": [131072, 131073]
29
+ ```
30
+
31
+ At training time, the `geodesic-megatron` pipeline reads this field via
32
+ `pipeline_training_run.py:_read_loss_mask_token_ids` and propagates it to
33
+ `cfg.tokenizer.loss_mask_token_ids`. The training step
34
+ (`src/megatron/bridge/training/gpt_step.py::_forward_step_common`) then applies a
35
+ multiplicative mask: `loss_mask *= ~torch.isin(labels, loss_mask_token_ids)`. The mechanism
36
+ is mode-agnostic and composes cleanly with the dataset's existing `loss_mask`.
37
+
38
+ Inference frameworks (vLLM, sfm-evals, transformers' `generate`) **ignore** the field
39
+ because they don't compute loss — so the same tokenizer artifact works for both training
40
+ and inference unchanged.
41
+
42
+ ## Compatibility notes
43
+
44
+ - **Embedding resize required**: adding the two special tokens grows the vocab by 2. The
45
+ training pipeline performs `model.resize_token_embeddings(new_vocab_size)` automatically
46
+ when the tokenizer's vocab exceeds the model's embedding rows; the new embedding rows are
47
+ randomly initialized and learned during training.
48
+ - **Same encoder otherwise**: every other token in the vocab is byte-identical to the source
49
+ tokenizer, so existing tokenized corpora that don't contain the new marker strings remain
50
+ unaffected.
51
+ - **Source commit pinning**: this fork was built from the source tokenizer's `main` revision
52
+ as of `2026-05-13`.
53
+
54
+ ## Provenance
55
+
56
+ - **Source tokenizer**: `geodesic-research/nemotron-base-tokenizer`
57
+ - **Built by**: `scripts/data/build_fyn1668_tokenizers.py`
58
+ - **Date**: `2026-05-13`
59
+ - **Campaign**: `im_fyn1668_v3` (quarantine masking)
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db0da112cd19b565c47685eb9ba2cf8ddc8647063dfed75925d0842bcbf1d517
3
+ size 17077871
tokenizer_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<s>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "</s>",
7
+ "is_local": false,
8
+ "model_input_names": [
9
+ "input_ids",
10
+ "attention_mask"
11
+ ],
12
+ "model_max_length": 262144,
13
+ "pad_token": null,
14
+ "tokenizer_class": "TokenizersBackend",
15
+ "unk_token": "<unk>",
16
+ "loss_mask_token_ids": [
17
+ 131072,
18
+ 131073
19
+ ]
20
+ }