HuggingFaceTB/everyday-conversations-llama3.1-2k
Viewer • Updated • 2.38k • 1.45k • 130
How to use Haleshot/Mathmate-7B-DELLA-ORPO-D with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Haleshot/Mathmate-7B-DELLA-ORPO-D")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Haleshot/Mathmate-7B-DELLA-ORPO-D")
model = AutoModelForCausalLM.from_pretrained("Haleshot/Mathmate-7B-DELLA-ORPO-D")
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 Haleshot/Mathmate-7B-DELLA-ORPO-D with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Haleshot/Mathmate-7B-DELLA-ORPO-D"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Haleshot/Mathmate-7B-DELLA-ORPO-D",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Haleshot/Mathmate-7B-DELLA-ORPO-D
How to use Haleshot/Mathmate-7B-DELLA-ORPO-D with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Haleshot/Mathmate-7B-DELLA-ORPO-D" \
--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": "Haleshot/Mathmate-7B-DELLA-ORPO-D",
"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 "Haleshot/Mathmate-7B-DELLA-ORPO-D" \
--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": "Haleshot/Mathmate-7B-DELLA-ORPO-D",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Haleshot/Mathmate-7B-DELLA-ORPO-D with Docker Model Runner:
docker model run hf.co/Haleshot/Mathmate-7B-DELLA-ORPO-D
Mathmate-7B-DELLA-ORPO-D is a finetuned version of Haleshot/Mathmate-7B-DELLA-ORPO using the ORPO method, combined with a LoRA adapter trained on everyday conversations.
The model incorporates training on the HuggingFaceTB/everyday-conversations-llama3.1-2k dataset, which focuses on everyday conversations and small talk.
Here's an example of how to use the model:
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_name = "Haleshot/Mathmate-7B-DELLA-ORPO-ORPO-D"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, device_map="auto")
def generate_response(prompt, max_length=512):
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_length=max_length, num_return_sequences=1, do_sample=True, temperature=0.7)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
prompt = "Let's have a casual conversation about weekend plans."
response = generate_response(prompt)
print(response)
Thanks to the HuggingFaceTB team for providing the everyday conversations dataset used in this finetuning process.
Base model
Haleshot/Mathmate-7B-DELLA