Views
No views yet
RthItalia/nano_compact_3b_qkvfp16 is the validated compact self-contained variant derived from Qwen/Qwen2.5-3B-Instruct.transformers plus trust_remote_code=True.q_proj, k_proj, v_proj: stored and loaded in fp16o_proj and most of the remaining transformer body: stored in Nano compact formatmodel.embed_tokens: stored as a single quantized copylm_head: tied custom head over the quantized embeddings8bit baseline3B run:2.3432 GB2.3432 GB~2.44 GB8bit baseline used for comparison:3.1703 GB~3.21 GB8bit baseline while recovering enough quality to pass the smoke comparison used during validation.8bit baseline on a small internal prompt suitetiedq)8bit reference.qkvfp16 was the first variant that restored acceptable behavior on the reference prompt set while keeping a substantial memory advantage.1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4repo_id = "RthItalia/nano_compact_3b_qkvfp16"
5
6tok = AutoTokenizer.from_pretrained(
7 repo_id,
8 use_fast=True,
9 trust_remote_code=True,
10)
11
12model = AutoModelForCausalLM.from_pretrained(
13 repo_id,
14 trust_remote_code=True,
15 device_map="cuda",
16 dtype=torch.float16,
17).eval()1messages = [
2 {"role": "user", "content": "Explain what a neural network is in exactly 3 simple sentences."}
3]
4
5text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
6inp = tok(text, return_tensors="pt").to(next(model.parameters()).device)
7
8with torch.no_grad():
9 out = model.generate(
10 **inp,
11 max_new_tokens=120,
12 do_sample=False,
13 repetition_penalty=1.08,
14 eos_token_id=tok.eos_token_id,
15 pad_token_id=tok.eos_token_id,
16 )
17
18print(tok.decode(out[0][inp["input_ids"].shape[-1]:], skip_special_tokens=True))pip install torch transformers accelerate safetensorsbitsandbytes is not required for this exported winner variant at runtime.trust_remote_code=True is required.NanoTiedHead implementation that ties output logits to the quantized embedding table without registering the embedding module twice.Qwen/Qwen2.5-3B-Instruct.Qwen/Qwen2.5-3B-Instruct, but this compact release should follow the licensing and distribution terms chosen for this Nano release repository.license: other instead of asserting Apache coverage for the full release package.Qwen/Qwen2.5-3B-Instructqkvfp16RthItalia/nano_compact_3b_qkvfp16