# Japanese Transformers documentation translation runner This repository is the versioned runner described by the Japanese Transformers documentation synchronization plan. It is intentionally language-neutral in its implementation: language, model, prompt, glossary, paths, cache prefix, and validation thresholds live in `configs/`. The runner has two safe local modes: ```bash python -m hf_doc_translation.sync \ --config transformers-ja \ --checkout /Users/steven/hf/transformers \ --base-ref ja-translation \ --environment staging \ --check-only \ --no-publish ``` The same `sync` entry point performs a backfill when `--force-backfill` is added. A production run must use an immutable runner revision, a pinned model revision, and a clean checkout. The runner refuses to load the model when the configured TranslateGemma revision is missing or floating. The GPU runtime loads the model through the exact Transformers checkout placed first on `PYTHONPATH`. Because documentation translation is text-only, it loads the checkpoint's Gemma 3 causal-language-model view and omits the unused vision tower; this gives native continuous batching the required text configuration while retaining the official TranslateGemma processor and chat template. It uses one persistent manager for cache misses and greedy decoding. The local test suite never downloads a model. The initial rollout keeps CUDA graphs and asynchronous double-buffering disabled. They can be tuned after deterministic smoke and backfill parity pass with an attention implementation that supports their warmup requirements. ## Repository contract - English Markdown under `docs/source/en` is the only source of truth. - The generated tree contains the same Markdown paths under `docs/source/ja`. - Existing Japanese Markdown is regenerated, including shared paths. - Japanese-only Markdown paths are removed from the generated tree. - Unexpected non-Markdown assets are reported and are never deleted automatically. - Protected source syntax is restored byte-for-byte before publication. - Translation cache records and run manifests are ordinary JSON files under the mounted `/translation-cache` directory. - The doc-builder HTML cache is read-only; the runner never passes `--html_page_cache_write`. ## Runtime prerequisites The current configuration pins TranslateGemma to `7d10f0b72f89a2d0f268cea30727d8b77c0d25c2` and the doc-builder checkout to `e60a538eea9817ab312196d0d233604b01697265`. Before a GPU Job is scheduled, an operator must accept the Gemma license for the Job service account, verify the current Jobs hardware name, and configure the scoped GitHub secret. These are external gates and are not silently inferred by this repository. `Jobs/submit.py` resolves the immutable runner revision, downloads that exact snapshot inside the Job, verifies the config is present, and sets `PYTHONPATH` to the downloaded `src/` directory. The runner dataset is not mounted as a Job volume. ## Job progression Run these commands from an operator environment with `huggingface_hub` 1.8 or newer and access to the `hf-doc-build` namespace: ```bash export GITHUB_TOKEN="$(gh auth token)" python Jobs/submit.py smoke python Jobs/submit.py backfill # after the 30-day staging soak: python Jobs/submit.py schedule --soak-complete unset GITHUB_TOKEN ``` The smoke Job must pass before the backfill is submitted. The launcher refuses to enable the daily schedule until the explicit `--soak-complete` acknowledgement is supplied; the 30-day staging soak and production review remain operational gates. A valid Jobs payment method and accepted TranslateGemma license are also required by the namespace/service account. Before spending GPU time, the runtime import preflight can be run locally from a dedicated Python 3.10+ environment with pip, setuptools, wheel, and compatible PyTorch/CUDA dependencies. It clones the same staging branch, installs the exact checkout's hard dependencies, imports the pinned Transformers source, and does not download or load the 27B model: ```bash PYTHONPATH=src python3 -m hf_doc_translation.sync preflight \ --config configs/transformers-ja.yml \ --repository https://github.com/stevhliu/transformers.git \ --base-ref ja-translation \ --environment staging ``` The preflight must report `"passed": true` before submitting a GPU smoke Job. `GITHUB_TOKEN` is read only from the submitter's local environment and passed as an encrypted Job secret. It is never read from this repository or written to the Hub runner dataset. The smoke Job does not receive the GitHub secret. The first staging PR must use the published `stevhliu/transformers:ja-translation` SHA. The runner publishes generated commits to the existing `stevhliu/transformers` fork: staging PRs target `stevhliu/transformers:ja-translation`, and production PRs target `huggingface/transformers:main`. No additional GitHub fork is required, but the Job's scoped `GITHUB_TOKEN` must be able to push to `stevhliu/transformers` and open the corresponding PRs.