Skip to content

Refactor/nemotron h inherit granitemoehybrid#45115

Draft
ArthurZucker wants to merge 28 commits intomainfrom
refactor/nemotron-h-inherit-granitemoehybrid
Draft

Refactor/nemotron h inherit granitemoehybrid#45115
ArthurZucker wants to merge 28 commits intomainfrom
refactor/nemotron-h-inherit-granitemoehybrid

Conversation

@ArthurZucker
Copy link
Copy Markdown
Collaborator

What does this PR do?

Fixes # (issue)

Code Agent Policy

The Transformers repo is currently being overwhelmed by a large number of PRs and issue comments written by
code agents. We are currently bottlenecked by our ability to review and respond to them. As a result,
we ask that new users do not submit pure code agent PRs at this time.
You may use code agents in drafting or to help you diagnose issues. We'd also ask autonomous "OpenClaw"-like agents
not to open any PRs or issues for the moment.

PRs that appear to be fully agent-written will probably be closed without review, and we may block users who do this
repeatedly or maliciously.

This is a rapidly-evolving situation that's causing significant shockwaves in the open-source community. As a result,
this policy is likely to be updated regularly in the near future. For more information, please read CONTRIBUTING.md.

  • I confirm that this is not a pure code agent PR.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

Lidang-Jiang and others added 28 commits March 27, 2026 16:17
…age processors

PR #45029 added @requires(backends=("vision", "torch", "torchvision")) to 67
PIL backend image_processing_pil_*.py files. This causes PIL backend classes
to become dummy objects when torchvision is not installed, making
AutoImageProcessor unable to find any working processor.

Fix: set @requires to ("vision",) for files that only need PIL, and
("vision", "torch") for files that also use torch directly. Also fix
5 modular source files so make fix-repo preserves the correct backends.

Fixes #45042

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ckends

Per reviewer feedback: the vision-only @requires decorator is redundant
for PIL backend classes since PilBackend base class already handles this.

- Remove @requires(backends=("vision",)) from 43 PIL backend files
- Remove unused `requires` import from 38 files (Category A)
- Keep @requires(backends=("vision", "torch")) on method-level decorators (Category B: 5 files)
Hub survey shows only 2 nemotron_h patterns exist:
- Dense (M,-,*): structurally identical to Bamba (Mamba2+FFN or Attn+FFN per layer)
- MoE (M,E,*): new arch, inherits from GraniteMoeHybrid

Changes:
- Replace NemotronHBlock+MIXER_TYPES dispatch with two explicit decoder layer
  classes (NemotronHMambaDecoderLayer, NemotronHAttentionDecoderLayer), both
  inheriting from GraniteMoeHybridDecoderLayer per transformers tenets
  ("different stages warrant explicit classes, not codepaths")
- "moe" layers are now mamba+MoE (two-stage, matching GraniteMoeHybrid) instead
  of pure-MoE single-dispatch layers
- Add NemotronHDenseConfig(PreTrainedConfig) with model_type="nemotron_h_dense"
  routing to BambaForCausalLM in auto-config (draft; weight converter needed)
- Add WeightRenaming entries in conversion_mapping.py for hub checkpoint compat

Ref: #44763 (review)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@github-actions
Copy link
Copy Markdown
Contributor

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=45115&sha=7b7d58

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.

3 participants