Text Generation
Transformers
Safetensors
qwen2
conversational
text-generation-inference
compressed-tensors
Instructions to use nm-testing/Qwen2-1.5B-Instruct-FP8W8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nm-testing/Qwen2-1.5B-Instruct-FP8W8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nm-testing/Qwen2-1.5B-Instruct-FP8W8") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nm-testing/Qwen2-1.5B-Instruct-FP8W8") model = AutoModelForCausalLM.from_pretrained("nm-testing/Qwen2-1.5B-Instruct-FP8W8", device_map="auto") 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 Settings
- vLLM
How to use nm-testing/Qwen2-1.5B-Instruct-FP8W8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nm-testing/Qwen2-1.5B-Instruct-FP8W8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nm-testing/Qwen2-1.5B-Instruct-FP8W8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nm-testing/Qwen2-1.5B-Instruct-FP8W8
- SGLang
How to use nm-testing/Qwen2-1.5B-Instruct-FP8W8 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 "nm-testing/Qwen2-1.5B-Instruct-FP8W8" \ --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": "nm-testing/Qwen2-1.5B-Instruct-FP8W8", "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 "nm-testing/Qwen2-1.5B-Instruct-FP8W8" \ --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": "nm-testing/Qwen2-1.5B-Instruct-FP8W8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use nm-testing/Qwen2-1.5B-Instruct-FP8W8 with Docker Model Runner:
docker model run hf.co/nm-testing/Qwen2-1.5B-Instruct-FP8W8
Updated compression_config to quantization_config
Browse files- config.json +22 -22
config.json
CHANGED
|
@@ -5,7 +5,27 @@
|
|
| 5 |
],
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
"bos_token_id": 151643,
|
| 8 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
"config_groups": {
|
| 10 |
"group_0": {
|
| 11 |
"input_activations": null,
|
|
@@ -34,25 +54,5 @@
|
|
| 34 |
"kv_cache_scheme": null,
|
| 35 |
"quant_method": "compressed-tensors",
|
| 36 |
"quantization_status": "frozen"
|
| 37 |
-
}
|
| 38 |
-
"eos_token_id": 151645,
|
| 39 |
-
"hidden_act": "silu",
|
| 40 |
-
"hidden_size": 1536,
|
| 41 |
-
"initializer_range": 0.02,
|
| 42 |
-
"intermediate_size": 8960,
|
| 43 |
-
"max_position_embeddings": 32768,
|
| 44 |
-
"max_window_layers": 28,
|
| 45 |
-
"model_type": "qwen2",
|
| 46 |
-
"num_attention_heads": 12,
|
| 47 |
-
"num_hidden_layers": 28,
|
| 48 |
-
"num_key_value_heads": 2,
|
| 49 |
-
"rms_norm_eps": 1e-06,
|
| 50 |
-
"rope_theta": 1000000.0,
|
| 51 |
-
"sliding_window": 32768,
|
| 52 |
-
"tie_word_embeddings": true,
|
| 53 |
-
"torch_dtype": "bfloat16",
|
| 54 |
-
"transformers_version": "4.42.4",
|
| 55 |
-
"use_cache": true,
|
| 56 |
-
"use_sliding_window": false,
|
| 57 |
-
"vocab_size": 151936
|
| 58 |
}
|
|
|
|
| 5 |
],
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
"bos_token_id": 151643,
|
| 8 |
+
"eos_token_id": 151645,
|
| 9 |
+
"hidden_act": "silu",
|
| 10 |
+
"hidden_size": 1536,
|
| 11 |
+
"initializer_range": 0.02,
|
| 12 |
+
"intermediate_size": 8960,
|
| 13 |
+
"max_position_embeddings": 32768,
|
| 14 |
+
"max_window_layers": 28,
|
| 15 |
+
"model_type": "qwen2",
|
| 16 |
+
"num_attention_heads": 12,
|
| 17 |
+
"num_hidden_layers": 28,
|
| 18 |
+
"num_key_value_heads": 2,
|
| 19 |
+
"rms_norm_eps": 1e-06,
|
| 20 |
+
"rope_theta": 1000000.0,
|
| 21 |
+
"sliding_window": 32768,
|
| 22 |
+
"tie_word_embeddings": true,
|
| 23 |
+
"torch_dtype": "bfloat16",
|
| 24 |
+
"transformers_version": "4.42.4",
|
| 25 |
+
"use_cache": true,
|
| 26 |
+
"use_sliding_window": false,
|
| 27 |
+
"vocab_size": 151936,
|
| 28 |
+
"quantization_config": {
|
| 29 |
"config_groups": {
|
| 30 |
"group_0": {
|
| 31 |
"input_activations": null,
|
|
|
|
| 54 |
"kv_cache_scheme": null,
|
| 55 |
"quant_method": "compressed-tensors",
|
| 56 |
"quantization_status": "frozen"
|
| 57 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
}
|