01 / Generated file guards
Distinguish current generators from legacy copies
The file describes two mechanisms for maintaining standalone model files. It permits existing copied blocks to be maintained through their source but directs new work toward modular files.
Source excerpt starting at line 34.341. `# Copied from ...` marks a copied class or function. `make fix-repo` re-syncs it, so editing inside such a block is reverted — edit the source it copies from, or deliberately break the link. **Do not add new `# Copied from` statements**; write a modular file instead.
02 / Generated file guards
Inspect the full output of a shared source change
A named modular file also generates another model family. The guide requires regeneration and review of every changed output, so a fix cannot quietly leave dependent generated code stale.
Source excerpt starting at line 39.39- **Other models inherit your modular file.** `modular_deepseek_vl.py` also generates `modeling_deepseek_vl_hybrid.py`. Run `make fix-repo` and check everything it rewrote; hand-editing only the generated file you had in mind leaves the rest stale and `Check repository consistency` red.
03 / Architecture as narrative
Explain a value that looks like a mistake
AttributeError is intentional converter syntax for removing inherited members. The file explains that replacing it with an apparently sensible value can change model sharding behavior.
Source excerpt starting at line 40.40- **`attr = AttributeError()` deletes an inherited attribute** — it is an instruction to the converter, not a bug or placeholder. `raise AttributeError("...")` in a method body does the same for a method. Substituting a "real" value silently changes behaviour (`_no_split_modules = AttributeError()` → `[]` changes how the model may be sharded). See [Removing attributes](../docs/source/en/modular_transformers.md#removing-attributes) and [Deleting unused methods](../docs/source/en/modular_transformers.md#deleting-unused-methods).
04 / Contribution etiquette
Check ownership and overlapping work before contributing
Before a PR, agents must coordinate on the issue and inspect open work. The guide supplies issue and PR queries and asks for an explanation when a different approach warrants another patch.
Source excerpt starting at line 18.18- Check for overlapping work, and do not open a second PR for a fix already covered: