Conversation
data/, output/ and HunyuanOCR/ are produced on the training box and are several GB once packing and checkpointing run; none of it belongs in git. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The three launchers built their flags into $args and then passed them as
"${args}". Quoted, the whole block reaches the entry point as ONE argv
element, so HfArgumentParser.parse_args_into_dataclasses() aborts before
training starts:
$ A="--x 1 --y 2"; python -c "import sys;print(sys.argv[1:])" "${A}"
['--x 1 --y 2']
$args is assembled inside double quotes, where backslash-newline is a line
continuation, so it is already a single flat line. Dropping the quotes lets
normal word splitting hand each flag over separately.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The counter dropped every line whose answer was empty:
if not question or not answer:
return None
For an OCR dataset an empty label is not missing data — it is the label of a
blank page, and it is what teaches the model to return nothing instead of
hallucinating text onto a sheet that carries none. Our set has 25 such pages
and silently losing them trains the opposite behaviour.
Empty answers are still skipped by default so upstream behaviour is unchanged;
pack_data.sh opts in via ALLOW_EMPTY=1 (its default). pack_data.sh also grows
FOREGROUND=1 to run in the foreground, which is what you want on a single box.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Reads <root>/<config>/<split>/metadata.jsonl + images and emits the schema the
code actually consumes:
{"img_path_sh": "/abs/x.jpg", "conv": [{"question": <prompt>, "answer": <md>}]}
Note this is NOT the schema in docs/data_format.md, which documents
image_path/conversations and a packed_samples/cu_seqlens output. No code in
the repo reads those keys — pipeline_count_and_pack.py reads
img_path_sh|img_path_cq + conv[0].question|answer, and data_processor.py reads
item["image"]/["question"]/["answer"] with one JSON array per packed line.
The prompt goes in `question` rather than a system message on purpose:
pack_data() never forwards `system` into the packed record, so a system prompt
is counted at pack time and then absent at train time.
Run over the 4-config Vietnamese OCR set: 1007 train / 120 validation,
0 missing images, 25 empty labels preserved.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
sft_base.sh targets an 8-GPU node behind InfiniBand. env_common.sh pins NCCL
to a bond1 interface and eight mlx5 HCAs, which do not exist on a single box,
so NCCL warns loudly or stalls at rendezvous. env_single.sh disables IB, keeps
NCCL on loopback, and sets expandable_segments to limit fragmentation as
activation size swings between packs.
sft_base_1gpu.sh retunes the same entry point for one 80GB card and a ~1k-page
domain set rather than a cluster and ~1M packs:
NPROC_PER_NODE 8 -> 1
packed_max_length 20480 -> 16384 (docs/training.md notes 20480 can OOM at 80GB)
GRAD_ACCUM 1 -> 4 (one pack per step is too noisy a batch)
SAVE_STEPS 200 -> 50 (an epoch here is well under 200 steps)
A 1B model in bf16 with gradient checkpointing fits full SFT at 80GB without
ZeRO, so DeepSpeed stays off and is opt-in via DEEPSPEED=scripts/zero2.json.
TUNE_VISION/TUNE_MLP/TUNE_LLM, PACK_LEN, LR, EPOCHS and RUN_NAME are all
env-overridable.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
End-to-end steps for this fork: environment, dataset conversion, packing,
training, and the parts of upstream that need care —
- flash-attn is mandatory; train_hunyuan.py hardcodes flash_attention_2
with no eager fallback, so it fails at model load, not at step 1.
- Do not enable eval during training: eval_dataset is built with
is_packed=False while the collator is PackedVLDataCollator, which expects
a list of lists.
- PACK_LEN must match between packing and training.
- docs/data_format.md documents a schema no code reads.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
No description provided.