Instructions to use open-machine/Qwen3-1.7B-FlashNorm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use open-machine/Qwen3-1.7B-FlashNorm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="open-machine/Qwen3-1.7B-FlashNorm") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("open-machine/Qwen3-1.7B-FlashNorm") model = AutoModelForCausalLM.from_pretrained("open-machine/Qwen3-1.7B-FlashNorm") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use open-machine/Qwen3-1.7B-FlashNorm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "open-machine/Qwen3-1.7B-FlashNorm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "open-machine/Qwen3-1.7B-FlashNorm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/open-machine/Qwen3-1.7B-FlashNorm
- SGLang
How to use open-machine/Qwen3-1.7B-FlashNorm with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "open-machine/Qwen3-1.7B-FlashNorm" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "open-machine/Qwen3-1.7B-FlashNorm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "open-machine/Qwen3-1.7B-FlashNorm" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "open-machine/Qwen3-1.7B-FlashNorm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use open-machine/Qwen3-1.7B-FlashNorm with Docker Model Runner:
docker model run hf.co/open-machine/Qwen3-1.7B-FlashNorm
Qwen3-1.7B-FlashNorm
This is a FlashNorm-prepared checkpoint of Qwen/Qwen3-1.7B, as presented in the paper FlashNorm: Fast Normalization for Transformers by Nils Graef, Matthew Clapp, and Andrew Wasielewski.
Mathematically equivalent to the source model. The per-channel RMSNorm weight tensors (input_layernorm.weight, post_attention_layernorm.weight, model.norm.weight) are folded into the following linear layers and then removed from the state dict entirely.
Framework support note. Stock vLLM currently does not load this checkpoint because the norm weight tensors are absent. The upstream patch to accept missing tensors is tracked at: TBD (vLLM issue link). Until the patch lands, use HuggingFace Transformers; it loads this with a warning that norm weights were not initialized and defaults them to ones, which is the correct behavior for FlashNorm.
What FlashNorm does
An exact reformulation of RMSNorm -> Linear:
- Fold the per-channel normalization weight
ginto the following linear layer:W_star = W @ diag(g), computed once at checkpoint conversion. - After folding, the RMSNorm layer has no learnable per-channel scale. At runtime it simply divides by
rms(x). - The resulting model computes the same output as the original, by Proposition 1 of the FlashNorm paper.
See the paper and the transformer-tricks repo for details.
Usage
Regenerate locally with transformer_tricks
import transformer_tricks as tt
tt.flashify_repo('Qwen/Qwen3-1.7B', strict=True)
Via HuggingFace Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained('open-machine/Qwen3-1.7B-FlashNorm')
model = AutoModelForCausalLM.from_pretrained('open-machine/Qwen3-1.7B-FlashNorm')
ids = tok('Once upon a time', return_tensors='pt').input_ids
out = model.generate(ids, max_new_tokens=50, do_sample=False)
print(tok.decode(out[0], skip_special_tokens=True))
A warning about missing norm weights is expected; Transformers defaults those to ones, which is the correct value for a FlashNorm checkpoint.
Via vLLM
Not yet supported. See the tracking issue linked above.
License
Inherited from the source model.
- Downloads last month
- 818