mirror of
https://github.com/p-e-w/heretic.git
synced 2026-12-03 18:42:57 +07:00
[GH-ISSUE #147] Nemotron3: Failed to load model with all configured dtypes. #88
Labels
No labels
bug
enhancement
enhancement
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
p-e-w/heretic#88
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mcr-ksh on GitHub (Feb 11, 2026).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/147
When trying Nemotron nvfp4 quantizised version.
Same issue with
nvfp4orauto.Any hint how todo it?
Got the model running on vLLM v0.14.1
transformers==4.57.6
numpy==2.2
@Vinay-Umrethe commented on GitHub (Feb 12, 2026):
this type of quantization is likely not supported, a PR was made by @accemlcc IG which supported bitsandbytes 4bit quant
@mcr-ksh commented on GitHub (Feb 12, 2026):
Also @accemlcc 4bit doesn't work
@Vinay-Umrethe commented on GitHub (Feb 12, 2026):
@mcr-ksh you tried to quant a model which is already with a different type, change it to this base model with 4 bit bnb
nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16
@nonetrix commented on GitHub (Feb 12, 2026):
I am on AMD so might be just AMD skill issue but I tried it with BF16 and it doesn't work sadly :/
Off topic but the irony of running a NVIDIA made model on a AMD GPU is not lost on me
@mcr-ksh commented on GitHub (Feb 12, 2026):
@Vinayyyy7 yes i know, I wanted to use that model as it is optimized for Blackwell and I wouldnt be be able to optimize the model in the same way as the author did. Thus this is requirement for me.
@red40maxxer commented on GitHub (Feb 13, 2026):
Nemotron3 is hybrid mamba-transformer which isn't supported by heretic, there's a PR for this but it hasn't been updated for a while
@Vinay-Umrethe commented on GitHub (Feb 13, 2026):
yes it's a mamba-ssm model for which you might require
mamba-ssmpackage, although heretic does not support it you can try installing it, or use pure pytorch complied mamba-ssm code@Vinay-Umrethe commented on GitHub (Feb 13, 2026):
mamba-models are already so efficient and fast, but since i's hybird of mamba-transformer (they call it jamba) the linear scaling and qudratic scaling mixes up, has the author release the code about their method of quantization, or they kept it private
@cpagac commented on GitHub (Feb 14, 2026):
@mcr-ksh
I ran into the same issue and built a patch that fixes this, plus several downstream crashes you'll
hit with NemotronH. The core problem, to my understanding, is that "fp8" / "nvfp4" are not valid PyTorch dtypes, so
from_pretrained(dtype="fp8") fails. An idea to fix these is to treat these as special tokens: skip the dtype=
parameter and use torch_dtype=torch.bfloat16 instead, letting HF Transformers auto-detect the
model's built-in quantization_config.
There are also roughly 10 more issues. After fixing the dtype loading, NemotronH will crash on:
with 3 different layer types (Mamba2 SSM, MoE with 128 experts, and Attention)
and Attention components entirely
Nones); needs a hook-based fallback
LoRA weights and corrupt the KL divergence score
My fork fixes all of these. The changes are in model.py (most of the work), config.py, main.py, and
evaluator.py. (Note: it's sloppy with a bunch of terribly named commits, mainly as I thought I was only coding it for myself)
Usage with the fix:
heretic --dtypes fp8 --trust-remote-code true --model cybermotaz/nemotron3-nano-nvfp4-w4a16
Note: --dtypes fp8 (not nvfp4) -- the fork treats "fp8" as the special token for all FP8/NVFP4
pre-quantized models.
Important VRAM note: This model is ~59GB at bfloat16 (HF loads the NVFP4 weights into bfloat16). On
your Thor (48GB), it will offload ~11GB to CPU/meta device, which causes slow inference (~11
min/trial) and potential NaN issues. For best results, you'd need an 80GB GPU (A100/H100).
Fork: https://github.com/venomx-pentester/heretic
Full changelog: FP8_NVFP4_CHANGES.md in the repo
@mcr-ksh commented on GitHub (Feb 18, 2026):
wow! That sounds way more complicated than just the datatype.
I just managed to give it a try but got stuck again:
Also without specifying
dtypes(auto) I get the same error. This is on a Jetson Orin (64GB).Same on Jetson Thor.
@cpagac commented on GitHub (Feb 19, 2026):
@mcr-ksh
I cleaned up some things as per p-e-w's request and added more fail-safes as I had trouble getting consistent results on my end. The original NVIDIA/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16 should work, but cybermotaz/nemotron3-nano-nvfp4-w4a16 is a different story — that model is NVFP4/W4A16 quantized, and from what I've seen, it appears to require a version of modelopt transformer_engine to interpret the quantization config at load time. The --dtypes fp8 flag is also problematic since heretic passes that string directly to Hugging Face, which expects a torch.Using a dtype object rather than an arbitrary string. The quantized variant requires a loading path that is out of scope for my PR, though.
If you want to give the branch a try on NVIDIA/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16: venomx-pentester:nemotron-support (on my fork). I couldn't test models of that size because of my 32GB VRAM limit, but it should work logically. If you do test it, please let me know your results!
Side note: NemotronH uses Mamba SSM layers, which require mamba-ssm to run. You'll be prompted automatically with install instructions and any other packages that can speed things up.
The updated PR is #166
@mcr-ksh commented on GitHub (Feb 19, 2026):
unfortunately the same problem.
@cpagac commented on GitHub (Feb 19, 2026):
The issue is the --dtypes fp8 flag. That string gets passed directly to HuggingFace, which expects a torch.dtype object, not an arbitrary string, hence the is_floating_point error. This isn't specific to this branch; it would fail the same way on v1.2.0.
Since the model is BF16 (referenced in the name of the model), just drop that flag entirely -- try:
heretic --trust-remote-code true NVIDIA/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16
@mcr-ksh commented on GitHub (Feb 19, 2026):
I was just editing my last post to reflect on that hence the original post stated about using "fp8" as a dtype.
Just a pitty that
cybermotaz/nemotron3-nano-nvfp4-w4a16is not working. That model is very well quantized and I'm not able to reproduce the quantization myself after "freeing" the model.@cpagac commented on GitHub (Feb 19, 2026):
One potential workaround I think might work is running heretic on the BF16 version to get the abliterated model, then re-quantize using vLLM's built-in quantization or modelopt you should be able to run it.
Not ideal but, it at least gets you to an abliterated quantized model without needing native NVFP4 support in heretic, as to my knowledge that would be a pretty big undertaking. I'll respond if I ever go down that rabbit hole.
@derekszen commented on GitHub (Mar 6, 2026):
Additional data point: this is still reproducible on a Qwen-family NVFP4 checkpoint, not just Nemotron.
I tested a local clone of
AxionML/Qwen3.5-9B-NVFP4on Arch Linux with an RTX 5090D (32 GB VRAM), keeping everything local. Heretic currently exposes quantization support asnone/bnb_4bit, and the Qwen NVFP4 checkpoint does not load cleanly through the current path.Observed behavior:
modelopt/compressed-tensors/ NVFP4 loading flow yet.quantization_config.quant_algo = "NVFP4".Environment notes from the failed attempt:
transformers/acceleratebased workflowIf support is added, Qwen NVFP4 would be a useful target in addition to Nemotron, since it is a more common consumer deployment format right now.