Views
No views yet
Marcoson320/codeparrot-gpt2-mi50 experimenting with adding end-of-sequence (<|endoftext|>) emission behavior to a code-completion model trained without document-boundary EOS tokens.tokenize function does not insert <|endoftext|> at document boundaries:1def tokenize(element):
2 outputs = tokenizer(
3 element["content"], truncation=True,
4 max_length=128, return_overflowing_tokens=True, ...
5 )
6 # no EOS inserted between documents| Item | Value |
|---|---|
| Base | Marcoson320/codeparrot-gpt2-mi50 (final checkpoint) |
| Optimizer | AdamW (β₁=0.9, β₂=0.999, weight_decay=0.1) |
| Learning rate | 5×10⁻⁵, cosine schedule, 100 warmup steps |
| Effective batch size | 256 (per_device_bs=32 × grad_accum=4 × world_size=2) |
| Steps | 4,000 |
| Precision | fp16 |
| Parallelism | DistributedDataParallel on 2 × MI50 |
| Wall clock | ~1h 44m |
| final train_loss | 1.162 |
| final eval_loss | 1.569 |
<|endoftext|> (id 0) appended explicitly, then padded to 128 with a label mask of -100 (so padding does not contribute to loss).repetition_penalty=1.12, no_repeat_ngram_size=4:| Prompt | Base | EOS-FT |
|---|---|---|
def add(a, b):\n return a + b\n | ✗ | ✓ (pos 13) |
def square(x):\n return x * x\n\n | ✗ | ✗ |
def greet(name):\n print(f'Hello {name}')\n\n | ✗ | ✓ (pos 47) |
import os\nprint(os.getcwd())\n | ✗ | ✗ |
x = 1\ny = 2\nz = x + y\n | ✗ | ✓ (pos 61) |
| Total emit rate | 0/5 | 3/5 |
FunctionDef / ClassDef blocks via ast.parse so the model only sees EOS at structural endpoints.1from transformers import pipeline
2
3pipe = pipeline(
4 "text-generation",
5 model="Marcoson320/codeparrot-gpt2-mi50-eos-ft",
6 device=0,
7)
8
9out = pipe(
10 "def add(a, b):\n return a + b\n",
11 max_new_tokens=80,
12 do_sample=False,
13 repetition_penalty=1.12,
14 no_repeat_ngram_size=4,
15)
16print(out[0]["generated_text"])train_eos_v2.py and test_eos.py.Marcoson320/codeparrot-gpt2-mi50