Intel/orca_dpo_pairs
Viewer • Updated • 12.9k • 2.34k • 322
How to use sreeramajay/TinyLlama-1.1B-orca-v1.0 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="sreeramajay/TinyLlama-1.1B-orca-v1.0")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForMultimodalLM
tokenizer = AutoTokenizer.from_pretrained("sreeramajay/TinyLlama-1.1B-orca-v1.0")
model = AutoModelForMultimodalLM.from_pretrained("sreeramajay/TinyLlama-1.1B-orca-v1.0")
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]:]))How to use sreeramajay/TinyLlama-1.1B-orca-v1.0 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "sreeramajay/TinyLlama-1.1B-orca-v1.0"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "sreeramajay/TinyLlama-1.1B-orca-v1.0",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/sreeramajay/TinyLlama-1.1B-orca-v1.0
How to use sreeramajay/TinyLlama-1.1B-orca-v1.0 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "sreeramajay/TinyLlama-1.1B-orca-v1.0" \
--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": "sreeramajay/TinyLlama-1.1B-orca-v1.0",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "sreeramajay/TinyLlama-1.1B-orca-v1.0" \
--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": "sreeramajay/TinyLlama-1.1B-orca-v1.0",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use sreeramajay/TinyLlama-1.1B-orca-v1.0 with Docker Model Runner:
docker model run hf.co/sreeramajay/TinyLlama-1.1B-orca-v1.0
Applied DPO to TinyLlama-1.1B-Chat-v1.0 using orca_dpo_pairs dataset
This is only experimental Model created by following instruction from the nice Blog Fine-tune a Mistral-7b model with Direct Preference Optimization
You can run this model using the following code:
# Format prompt
message = [
{"role": "system", "content": "You are a helpful assistant chatbot."},
{"role": "user", "content": "What is a Large Language Model?"}
]
tokenizer = AutoTokenizer.from_pretrained(new_model)
prompt = tokenizer.apply_chat_template(message, add_generation_prompt=True, tokenize=False)
# Create pipeline
pipeline = transformers.pipeline(
"text-generation",
model=new_model,
tokenizer=tokenizer
)
# Generate text
sequences = pipeline(
prompt,
do_sample=True,
temperature=0.7,
top_p=0.9,
num_return_sequences=1,
max_length=200,
)
print(sequences[0]['generated_text'])
# <|system|>
# You are a helpful assistant chatbot.</s>
# <|user|>
# What is a Large Language Model?</s>
# <|assistant|>
# A Large Language Model (LLM) is a type of deep learning model that processes large amounts of text or data to improve the accuracy of natural language processing tasks such as sentiment analysis, machine translation, and question answering. LLMs are trained using large datasets, which allow them to generalize better and have better performance compared to traditional machine learning models. They are capable of handling vast amounts of text and can learn complex relationships between words, phrases, and sentences, making them an essential tool for natural language processing.
Results on GPT4ALL benchmark:
| Tasks | Metric | Value | Stderr | |
|---|---|---|---|---|
| arc_challenge | acc | 0.3003 | ± | 0.0134 |
| acc_norm | 0.3276 | ± | 0.0137 | |
| arc_easy | acc | 0.6115 | ± | 0.0100 |
| acc_norm | 0.5354 | ± | 0.0102 | |
| boolq | acc | 0.6147 | ± | 0.0085 |
| hellaswag | acc | 0.4633 | ± | 0.0050 |
| acc_norm | 0.6033 | ± | 0.0049 | |
| openbookqa | acc | 0.2480 | ± | 0.0193 |
| acc_norm | 0.3720 | ± | 0.0216 | |
| piqa | acc | 0.7470 | ± | 0.0101 |
| acc_norm | 0.7470 | ± | 0.0101 | |
| winogrande | acc | 0.6054 | ± | 0.0137 |