Instructions to use llmware/bling-phi-3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use llmware/bling-phi-3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="llmware/bling-phi-3", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("llmware/bling-phi-3", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("llmware/bling-phi-3", trust_remote_code=True, 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use llmware/bling-phi-3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "llmware/bling-phi-3" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "llmware/bling-phi-3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/llmware/bling-phi-3
- SGLang
How to use llmware/bling-phi-3 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 "llmware/bling-phi-3" \ --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": "llmware/bling-phi-3", "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 "llmware/bling-phi-3" \ --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": "llmware/bling-phi-3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use llmware/bling-phi-3 with Docker Model Runner:
docker model run hf.co/llmware/bling-phi-3
Update README.md
Browse files
README.md
CHANGED
|
@@ -23,7 +23,9 @@ Evaluated against the benchmark test: [RAG-Instruct-Benchmark-Tester](https://
|
|
| 23 |
--Summarization Quality (1-5): 4 (Above Average)
|
| 24 |
--Hallucinations: No hallucinations observed in test runs.
|
| 25 |
|
| 26 |
-
For test run results (and good indicator of target use cases), please see the files ("core_rag_test" and "answer_sheet" in this repo).
|
|
|
|
|
|
|
| 27 |
|
| 28 |
### Model Description
|
| 29 |
|
|
@@ -99,15 +101,15 @@ If you are using a HuggingFace generation script:
|
|
| 99 |
inputs = tokenizer(new_prompt, return_tensors="pt")
|
| 100 |
start_of_output = len(inputs.input_ids[0])
|
| 101 |
|
| 102 |
-
# temperature: set at 0.
|
| 103 |
# max_new_tokens: set at 100 - may prematurely stop a few of the summaries
|
| 104 |
|
| 105 |
outputs = model.generate(
|
| 106 |
inputs.input_ids.to(device),
|
| 107 |
eos_token_id=tokenizer.eos_token_id,
|
| 108 |
pad_token_id=tokenizer.eos_token_id,
|
| 109 |
-
do_sample=
|
| 110 |
-
temperature=0.
|
| 111 |
max_new_tokens=100,
|
| 112 |
)
|
| 113 |
|
|
|
|
| 23 |
--Summarization Quality (1-5): 4 (Above Average)
|
| 24 |
--Hallucinations: No hallucinations observed in test runs.
|
| 25 |
|
| 26 |
+
For test run results (and good indicator of target use cases), please see the files ("core_rag_test" and "answer_sheet" in this repo).
|
| 27 |
+
|
| 28 |
+
Note: the Pytorch version answered 1 question with "Not Found" while the quantized version answered it correctly, hence the small difference in scores.
|
| 29 |
|
| 30 |
### Model Description
|
| 31 |
|
|
|
|
| 101 |
inputs = tokenizer(new_prompt, return_tensors="pt")
|
| 102 |
start_of_output = len(inputs.input_ids[0])
|
| 103 |
|
| 104 |
+
# temperature: set at 0.0 with do_sample=False for consistency of output
|
| 105 |
# max_new_tokens: set at 100 - may prematurely stop a few of the summaries
|
| 106 |
|
| 107 |
outputs = model.generate(
|
| 108 |
inputs.input_ids.to(device),
|
| 109 |
eos_token_id=tokenizer.eos_token_id,
|
| 110 |
pad_token_id=tokenizer.eos_token_id,
|
| 111 |
+
do_sample=False,
|
| 112 |
+
temperature=0.0,
|
| 113 |
max_new_tokens=100,
|
| 114 |
)
|
| 115 |
|