Instructions to use TheBloke/phi-2-GPTQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TheBloke/phi-2-GPTQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TheBloke/phi-2-GPTQ", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("TheBloke/phi-2-GPTQ", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use TheBloke/phi-2-GPTQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TheBloke/phi-2-GPTQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TheBloke/phi-2-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TheBloke/phi-2-GPTQ
- SGLang
How to use TheBloke/phi-2-GPTQ 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 "TheBloke/phi-2-GPTQ" \ --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": "TheBloke/phi-2-GPTQ", "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 "TheBloke/phi-2-GPTQ" \ --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": "TheBloke/phi-2-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TheBloke/phi-2-GPTQ with Docker Model Runner:
docker model run hf.co/TheBloke/phi-2-GPTQ
No GGUF ?
...
also waiting!
When trying to convert with llamacpp I have :
(sati) rob@Robins-MBP-2 llama.cpp % python3 ./convert.py ../phi-2
Loading model file ../phi-2/model-00001-of-00002.safetensors
Loading model file ../phi-2/model-00001-of-00002.safetensors
Loading model file ../phi-2/model-00002-of-00002.safetensors
Traceback (most recent call last):
File "/Users/rob/Downloads/llama.cpp/./convert.py", line 1228, in
main()
File "/Users/rob/Downloads/llama.cpp/./convert.py", line 1161, in main
model_plus = load_some_model(args.model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rob/Downloads/llama.cpp/./convert.py", line 1078, in load_some_model
model_plus = merge_multifile_models(models_plus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rob/Downloads/llama.cpp/./convert.py", line 593, in merge_multifile_models
model = merge_sharded([mp.model for mp in models_plus])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rob/Downloads/llama.cpp/./convert.py", line 572, in merge_sharded
return {name: convert(name) for name in names}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rob/Downloads/llama.cpp/./convert.py", line 572, in
return {name: convert(name) for name in names}
^^^^^^^^^^^^^
File "/Users/rob/Downloads/llama.cpp/./convert.py", line 547, in convert
lazy_tensors: list[LazyTensor] = [model[name] for model in models]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rob/Downloads/llama.cpp/./convert.py", line 547, in
lazy_tensors: list[LazyTensor] = [model[name] for model in models]
~~~~~^^^^^^
KeyError: 'transformer.embd.wte.weight'
(sati) rob@Robins-MBP-2 llama.cpp %
Been following this : https://github.com/mrgraycode/llama.cpp/commit/12cc80cb8975aea3bc9f39d3c9b84f7001ab94c5#diff-150dc86746a90bad4fc2c3334aeb9b5887b3adad3cc1459446717638605348efR6239
Here you go : https://huggingface.co/kroonen/phi-2-GGUF/tree/main
Hi kroonen,
Could you create a 4Q version ? The 8Q ver. might be too slow for my cpu. :P
Thanks !