Downloads · 30 days
14
4% of all-time downloads
catplusplus/Qwen3.5-122B-A10B-heretic-v2-NVFP4
Qwen3.5-122B-A10B-heretic-v2-NVFP4 is a machine learning model from catplusplus. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
The model was converted to nvfp4 using llmcompressor and script below on a dual H200 runpod instance. It can generate outputs unsuitable for all audiences.
Downloads · 30 days
14
4% of all-time downloads
All-time downloads
329
Public
Parameters
71.2B
76.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors76.4 GB · 100%
How the weights are stored.
U858.7B · 82%
From the Hugging Face model README
The model was converted to nvfp4 using llmcompressor and script below on a dual H200 runpod instance. It can generate outputs unsuitable for all audiences.
import os import sys import shutil
from datasets import concatenate_datasets, load_dataset from huggingface_hub import snapshot_download from transformers import AutoModelForImageTextToText, AutoTokenizer
from llmcompressor import oneshot from llmcompressor.modifiers.quantization import QuantizationModifier from llmcompressor.utils import dispatch_for_generation
#MODEL_ID = "Qwen/Qwen3.5-35B-A3B" MODEL_ID = sys.argv[1]
model = AutoModelForImageTextToText.from_pretrained(MODEL_ID, dtype="auto") tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
NUM_CALIBRATION_SAMPLES = 256 MAX_SEQUENCE_LENGTH = 4096
samples_per_dataset = NUM_CALIBRATION_SAMPLES // 2
ds_ultrachat = load_dataset( "HuggingFaceH4/ultrachat_200k", split=f"train_sft[:{samples_per_dataset}]", ) ds_nemotron = load_dataset( "nvidia/Nemotron-Post-Training-Dataset-v2", split=f"chat[:{samples_per_dataset}]", )
ds_ultrachat = ds_ultrachat.select_columns(["messages"]) ds_nemotron = ds_nemotron.select_columns(["messages"]) ds = concatenate_datasets([ds_ultrachat, ds_nemotron]) ds = ds.shuffle(seed=42)
def preprocess(example): return { "text": tokenizer.apply_chat_template( example["messages"], tokenize=False, ) }
ds = ds.map(preprocess)
def tokenize(sample): return tokenizer( sample["text"], padding=False, max_length=MAX_SEQUENCE_LENGTH, truncation=True, add_special_tokens=False, )
ds = ds.map(tokenize, remove_columns=ds.column_names)
recipe = QuantizationModifier( targets="Linear", scheme="NVFP4", ignore=[ "lm_head", "re:.*mlp.gate$", "re:.mlp.shared_expert_gate$", "re:.linear_attn.", "re:model\.visual\..", ], )
moe_calibrate_all_experts to True to ensure all experts receiveCalibrationQwen3_5MoeSparseMoeBlock (from llmcompressor.modeling.qwen3_5_moe)Qwen3_5MoeSparseMoeBlock class.oneshot( model=model, dataset=ds, recipe=recipe, max_seq_length=MAX_SEQUENCE_LENGTH, num_calibration_samples=NUM_CALIBRATION_SAMPLES, moe_calibrate_all_experts=True, )
print("\n\n") print("========== SAMPLE GENERATION ==============") try: dispatch_for_generation(model) input_ids = tokenizer("Hello my name is", return_tensors="pt").input_ids.to( model.device ) output = model.generate(input_ids, max_new_tokens=100) print(tokenizer.decode(output[0])) except Exception as e: print(f"Generation failed (non-fatal): {e}") print("==========================================\n\n")
SAVE_DIR = MODEL_ID.rstrip("/").split("/")[-1] + "-NVFP4" model.save_pretrained(SAVE_DIR, save_compressed=True) tokenizer.save_pretrained(SAVE_DIR)
cache_dir = snapshot_download(MODEL_ID, allow_patterns=["*.json"]) for filename in [ "preprocessor_config.json", "video_preprocessor_config.json", ]: src = os.path.join(cache_dir, filename) if os.path.exists(src): shutil.copyfile(src, os.path.join(SAVE_DIR, filename))