Add inference/generate pipeline to dynamic training#52
Open
dailykim149656-source wants to merge 1 commit into
Open
Add inference/generate pipeline to dynamic training#52dailykim149656-source wants to merge 1 commit into
dailykim149656-source wants to merge 1 commit into
Conversation
- New generate.m: forward-only text generation using 3 ANE kernels (sdpaFwd, woFwd, ffnFused) instead of 10 training kernels - Loads checkpoint weights, skips Adam state via fseek - Greedy and temperature+top-k sampling - llama2.c tokenizer.bin support for detokenization - Add 'generate' Makefile target - Document generate usage in training README Verified: builds clean for stories110m and qwen3_06b, runs at ~44-56ms/token on M2 after 200 training steps (loss 6.39).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
1 similar comment
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a standalone text-generation (inference) tool to the dynamic training pipeline, making it possible to run forward-only generation from a trained checkpoint on the ANE.
Motivation
The dynamic pipeline can train (
train.m) and benchmark, but there was no way to actually generate text from a trained checkpoint. For a research project exploring ANE training, the ability to inspect model output — does the network actually learn anything? what does the text look like? — is the most direct feedback loop. This fills that gap with minimal new code: one new file, one Makefile target, one README section.What it does
generate.mis a forward-only inference pipeline:fseek-skips past Adam optimizer state to load only the model weightssdpaFwd,woFwd,ffnFused) instead of the 10 kernels the trainer needs — no backward, no optimizer, no gradient machinery--temp 0) and temperature + top-k samplingtokenizer.binfrom the working directory; if absent, prints raw token IDs as a fallbackSEQtokens of the data fileUsage
CLI flags:
--ckpt,--tokens,--temp,--topk,--data,--seed,--help.Verification
stories110mandqwen3_06bmodel configs--helpand missing-argument error handling confirmedFiles changed
training/training_dynamic/generate.mtraining/training_dynamic/Makefilegeneratetarget, updatecleantraining/README.mdNotes
train.m,cpu_ops.h, etc. are untouched)config.h/io.h/cpu_ops.h/mil_dynamic.hheaders, sameMODEL-driven Makefile pattern, same checkpoint formatgeneratebinary is added to.gitignore-style clean targets; the source filegenerate.mis committed