Skip to content

Examples/py edu gemma moe - #219

Open
aaishwarymishra wants to merge 23 commits into
mainfrom
examples/py-edu-gemma-moe
Open

aaishwarymishra wants to merge 23 commits into
mainfrom
examples/py-edu-gemma-moe

Conversation

@aaishwarymishra

Copy link
Copy Markdown
Member

Summary

Adds new example

AI usage

  • No AI tools were used for this contribution
  • AI tools were used to assist this contribution

Tool(s) and usage:

Human Submission Confirmation

  • This PR was manually reviewed, committed, and submitted by a human contributor (not an automated agent)

Testing

  • Tests added or updated where needed
  • Existing tests and checks pass
  • Documentation updated if needed

Extraction is CPU-bound, so Dataset.from_generator now runs one process per shard. dataset_size caps the output for smoke runs and joins the cache fingerprint so capped and full builds never share an entry.
Drop the one-off benchmarks module and share generation between the sample and benchmark paths.
main.py now defaults to configs/moe.yaml; dense stays a control run.
Single RTX4090 spot instance runs main.py directly; CONFIG selects moe or dense.
A plain string pattern is a literal in tokenizers, so the Split never matched and BPE trained on whole documents, which OOMed the corpus fit. Keep the -code cache key: the failed fit never wrote a file.
The "code" arm uses Qwen2.5-Coder's pre-tokenizer, which needs 3.4% fewer
tokens per function than GPT-2's regex on this corpus; "gpt2" keeps the
ByteLevel baseline earlier runs used. Both arms share vocab size, corpus,
and trainer, and keep the reference special-token layout (<eos> trained in,
<pad> appended), so cells differ by a single factor.

Also log to ClearML every 1000 steps for the remote runs and pin
skypilot>=0.14.2, whose API server no longer needs FastAPI's removed
app-level `prefix`.
Fitted on the full corpus, Qwen2.5-Coder's pre-tokenizer needs 1.72% fewer
tokens per function than GPT-2's regex (146.9 vs 149.4 on the same 2,007
functions). That is not worth two runs: the corpus and the 512-token filter
admit the same examples either way, so fixed epochs see the same data, and
164 HumanEval problems cannot resolve a 1-2 task delta.

So the loader has one pre-tokenizer again, configs/{moe,dense}_gpt2.yaml are
gone, and the two cells are MoE vs dense on the same tokenizer.

The fitted JSON is 525 KB (over the repo hook's 500 KB limit), so it stays
untracked; outputs/tokenizers/...-code.json is the full-corpus artifact.
The code-aware pre-tokenizer was only 1.72% cheaper (146.9 vs 149.4 tokens
per function), which is not worth an arm, and it is not the recipe behind
the earlier 19/164 run. Keep the single recipe functionally identical to
`moe-training:py-edu-gemma-moe/preprocessors/python_bpe.py`: GPT-2
ByteLevel, no post-processor, <eos> trained in and <pad> appended.

The cache file ends in `-gpt2.json` so the old split-every-space
`...-8192-2.json` is never reused. Two full-corpus fits give the same
sha256 (38ccfb7c...).
Task names were bare timestamps, so two runs in different projects were
indistinguishable in the ClearML UI. Prefix the run name, which is the
parent directory of the timestamped run dir.
SkyPilot lists Vast instances through /api/v0/instances, which Vast
retired with 410 Gone, so `sky` can create a machine but can neither see
nor destroy it. The launcher pins 1x RTX 3090, checks the GPU that was
actually allocated, and tears the instance down when training ends or
when setup fails.

- register the SSH key through the API; onstart writes are ignored here
- detach the job with braces, else launch() blocks until training ends
- stream train.log to disk as it arrives instead of copying at the end
- upload the fitted tokenizer to skip a 10-25 min refit per instance
- price offers with the rented disk, not the 5 GB search default

uv.lock bypasses check-added-large-files: it pins torch 2.15 against
CUDA 13 wheels, and the repo already tracks a 1.17 MB root uv.lock.
Show the dataset, collator, both architectures, and inference using the
weights and tokenizer published on the Hub, so no ClearML credentials are
needed. Capped dataset loads now stream instead of pulling the full 6 GB
corpus.
@netlify

netlify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for trainite canceled.

Name Link
🔨 Latest commit 5aeaf57
🔍 Latest deploy log https://app.netlify.com/projects/trainite/deploys/6afd9f56d3fc9f8a3d5adc00

@aaishwarymishra
aaishwarymishra marked this pull request as draft November 18, 2026 10:59
SkyPilot's Vast backend could not list or destroy instances and attached
the wrong SSH keys, so the reported runs used a private vastai script
that does not belong in a provider-agnostic example. sky.yaml is now
unpinned from Vast and the README and notebook say how the runs were
actually produced.
Nothing in the example uses the Vast driver any more; sky check picks the
provider matching the user's credentials. Drops vastai, vastai-sdk and
the receipt-generation dependencies from the lock.
…examples

Lead with the task, the two configs, the metrics and the results instead of
the generated project boilerplate. Launcher details live in the cloud
section, so the walkthrough notebook points at the README instead of
carrying SkyPilot notes of its own.
…ache name

The file is a corpus-fitted byte-level BPE, not the GPT-2 tokenizer; only the
regex pre-tokenizer matches GPT-2. The cache key is already unique on dataset,
split, vocab size and min frequency, so the suffix adds nothing. Existing
-gpt2.json caches stop being picked up and the tokenizer is refit once.
…se vs. MoE

The question is how much Python a 15M Gemma 4 model learns; the dense and MoE
arms are one comparison inside it. Explain the function-level corpus from the
HumanEval task shape, and drop the "storage, not capacity" verdict: both arms
only did four epochs of next-token pretraining, so post-training could still
make the experts useful.
…uted

Give the binomial formula and its range, and note that the paired McNemar test
cannot reject a one-task gap for any per-problem pairing. Say plainly that only
sampling noise is covered: one seed per arm leaves training variance unmeasured.
@aaishwarymishra
aaishwarymishra marked this pull request as ready for review November 18, 2026 12:48

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant