Text Generation
Transformers
Safetensors
English
phi3
text-generation-inference
trl
sft
conversational
custom_code
Instructions to use Giang07/phi3-mini-4k-qlora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Giang07/phi3-mini-4k-qlora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Giang07/phi3-mini-4k-qlora", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Giang07/phi3-mini-4k-qlora", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("Giang07/phi3-mini-4k-qlora", trust_remote_code=True) 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 Giang07/phi3-mini-4k-qlora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Giang07/phi3-mini-4k-qlora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Giang07/phi3-mini-4k-qlora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Giang07/phi3-mini-4k-qlora
- SGLang
How to use Giang07/phi3-mini-4k-qlora 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 "Giang07/phi3-mini-4k-qlora" \ --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": "Giang07/phi3-mini-4k-qlora", "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 "Giang07/phi3-mini-4k-qlora" \ --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": "Giang07/phi3-mini-4k-qlora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Giang07/phi3-mini-4k-qlora with Docker Model Runner:
docker model run hf.co/Giang07/phi3-mini-4k-qlora
Upload Phi3ForCausalLM
Browse files- README.md +1 -1
- config.json +2 -1
- generation_config.json +1 -1
- model-00001-of-00002.safetensors +1 -1
- model-00002-of-00002.safetensors +1 -1
README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
| 2 |
language:
|
| 3 |
- en
|
| 4 |
license: mit
|
|
|
|
| 5 |
tags:
|
| 6 |
- text-generation-inference
|
| 7 |
- trl
|
| 8 |
- sft
|
| 9 |
-
pipeline_tag: text-generation
|
| 10 |
---
|
|
|
|
| 2 |
language:
|
| 3 |
- en
|
| 4 |
license: mit
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
tags:
|
| 7 |
- text-generation-inference
|
| 8 |
- trl
|
| 9 |
- sft
|
|
|
|
| 10 |
---
|
config.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
| 3 |
"architectures": [
|
| 4 |
"Phi3ForCausalLM"
|
| 5 |
],
|
|
|
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
"auto_map": {
|
| 8 |
"AutoConfig": "microsoft/Phi-3-mini-4k-instruct--configuration_phi3.Phi3Config",
|
|
@@ -29,7 +30,7 @@
|
|
| 29 |
"sliding_window": 2047,
|
| 30 |
"tie_word_embeddings": false,
|
| 31 |
"torch_dtype": "float16",
|
| 32 |
-
"transformers_version": "4.41.
|
| 33 |
"use_cache": true,
|
| 34 |
"vocab_size": 32064
|
| 35 |
}
|
|
|
|
| 3 |
"architectures": [
|
| 4 |
"Phi3ForCausalLM"
|
| 5 |
],
|
| 6 |
+
"attention_bias": false,
|
| 7 |
"attention_dropout": 0.0,
|
| 8 |
"auto_map": {
|
| 9 |
"AutoConfig": "microsoft/Phi-3-mini-4k-instruct--configuration_phi3.Phi3Config",
|
|
|
|
| 30 |
"sliding_window": 2047,
|
| 31 |
"tie_word_embeddings": false,
|
| 32 |
"torch_dtype": "float16",
|
| 33 |
+
"transformers_version": "4.41.2",
|
| 34 |
"use_cache": true,
|
| 35 |
"vocab_size": 32064
|
| 36 |
}
|
generation_config.json
CHANGED
|
@@ -7,5 +7,5 @@
|
|
| 7 |
32007
|
| 8 |
],
|
| 9 |
"pad_token_id": 32000,
|
| 10 |
-
"transformers_version": "4.41.
|
| 11 |
}
|
|
|
|
| 7 |
32007
|
| 8 |
],
|
| 9 |
"pad_token_id": 32000,
|
| 10 |
+
"transformers_version": "4.41.2"
|
| 11 |
}
|
model-00001-of-00002.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4972489200
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:89bd6ab32adfd6a6696229c1c5f955ff0df6753e39ae498d1557fc68c6bfb8f8
|
| 3 |
size 4972489200
|
model-00002-of-00002.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2669692488
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:409550382fb434cc224d90a33aa628ba6ebe60648ff09bfb55b9c560c36f033d
|
| 3 |
size 2669692488
|