Text Generation
Transformers
Safetensors
phi
text-generation-inference
4-bit precision
intel/auto-round
Instructions to use INC4AI/phi-2-int4-inc with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use INC4AI/phi-2-int4-inc with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="INC4AI/phi-2-int4-inc")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("INC4AI/phi-2-int4-inc") model = AutoModelForCausalLM.from_pretrained("INC4AI/phi-2-int4-inc") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use INC4AI/phi-2-int4-inc with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "INC4AI/phi-2-int4-inc" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "INC4AI/phi-2-int4-inc", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/INC4AI/phi-2-int4-inc
- SGLang
How to use INC4AI/phi-2-int4-inc 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 "INC4AI/phi-2-int4-inc" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "INC4AI/phi-2-int4-inc", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "INC4AI/phi-2-int4-inc" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "INC4AI/phi-2-int4-inc", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use INC4AI/phi-2-int4-inc with Docker Model Runner:
docker model run hf.co/INC4AI/phi-2-int4-inc
upload autoround format
Browse filesSigned-off-by: n1ck-guo <heng.guo@intel.com>
config.json
CHANGED
|
@@ -22,10 +22,10 @@
|
|
| 22 |
"quantization_config": {
|
| 23 |
"amp": true,
|
| 24 |
"autoround_version": "0.3.1.dev",
|
|
|
|
| 25 |
"bits": 4,
|
| 26 |
-
"damp_percent": 0.01,
|
| 27 |
"data_type": "int",
|
| 28 |
-
"
|
| 29 |
"enable_minmax_tuning": true,
|
| 30 |
"enable_norm_bias_tuning": false,
|
| 31 |
"enable_quanted_input": true,
|
|
@@ -37,12 +37,11 @@
|
|
| 37 |
"minmax_lr": 0.001,
|
| 38 |
"nsamples": 512,
|
| 39 |
"quant_block_list": null,
|
| 40 |
-
"quant_method": "
|
| 41 |
"scale_dtype": "torch.float16",
|
| 42 |
"seqlen": 2048,
|
| 43 |
"sym": true,
|
| 44 |
-
"train_bs": 8
|
| 45 |
-
"true_sequential": false
|
| 46 |
},
|
| 47 |
"resid_pdrop": 0.1,
|
| 48 |
"rope_scaling": null,
|
|
|
|
| 22 |
"quantization_config": {
|
| 23 |
"amp": true,
|
| 24 |
"autoround_version": "0.3.1.dev",
|
| 25 |
+
"backend": "auto_round:gptq:exllamav2",
|
| 26 |
"bits": 4,
|
|
|
|
| 27 |
"data_type": "int",
|
| 28 |
+
"dataset": "NeelNanda/pile-10k",
|
| 29 |
"enable_minmax_tuning": true,
|
| 30 |
"enable_norm_bias_tuning": false,
|
| 31 |
"enable_quanted_input": true,
|
|
|
|
| 37 |
"minmax_lr": 0.001,
|
| 38 |
"nsamples": 512,
|
| 39 |
"quant_block_list": null,
|
| 40 |
+
"quant_method": "intel/auto-round",
|
| 41 |
"scale_dtype": "torch.float16",
|
| 42 |
"seqlen": 2048,
|
| 43 |
"sym": true,
|
| 44 |
+
"train_bs": 8
|
|
|
|
| 45 |
},
|
| 46 |
"resid_pdrop": 0.1,
|
| 47 |
"rope_scaling": null,
|
quantize_config.json → quantization_config.json
RENAMED
|
@@ -17,9 +17,8 @@
|
|
| 17 |
"low_gpu_mem_usage": false,
|
| 18 |
"quant_block_list": null,
|
| 19 |
"enable_norm_bias_tuning": false,
|
|
|
|
| 20 |
"autoround_version": "0.3.1.dev",
|
| 21 |
-
"quant_method": "
|
| 22 |
-
"
|
| 23 |
-
"true_sequential": false,
|
| 24 |
-
"damp_percent": 0.01
|
| 25 |
}
|
|
|
|
| 17 |
"low_gpu_mem_usage": false,
|
| 18 |
"quant_block_list": null,
|
| 19 |
"enable_norm_bias_tuning": false,
|
| 20 |
+
"dataset": "NeelNanda/pile-10k",
|
| 21 |
"autoround_version": "0.3.1.dev",
|
| 22 |
+
"quant_method": "intel/auto-round",
|
| 23 |
+
"backend": "auto_round:gptq:exllamav2"
|
|
|
|
|
|
|
| 24 |
}
|