maywell/ko_Ultrafeedback_binarized
Viewer • Updated • 62k • 106 • 38
How to use chihoonlee10/T3Q-LLM-MG-v1.0 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="chihoonlee10/T3Q-LLM-MG-v1.0")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("chihoonlee10/T3Q-LLM-MG-v1.0")
model = AutoModelForCausalLM.from_pretrained("chihoonlee10/T3Q-LLM-MG-v1.0", 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=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use chihoonlee10/T3Q-LLM-MG-v1.0 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "chihoonlee10/T3Q-LLM-MG-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": "chihoonlee10/T3Q-LLM-MG-v1.0",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/chihoonlee10/T3Q-LLM-MG-v1.0
How to use chihoonlee10/T3Q-LLM-MG-v1.0 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "chihoonlee10/T3Q-LLM-MG-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": "chihoonlee10/T3Q-LLM-MG-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 "chihoonlee10/T3Q-LLM-MG-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": "chihoonlee10/T3Q-LLM-MG-v1.0",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use chihoonlee10/T3Q-LLM-MG-v1.0 with Docker Model Runner:
docker model run hf.co/chihoonlee10/T3Q-LLM-MG-v1.0
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
MODEL_DIR = "chihoonlee10/T3Q-LLM-MG-v1.0"
model = AutoModelForCausalLM.from_pretrained(MODEL_DIR, torch_dtype=torch.float16).to("cuda")
tokenizer = AutoTokenizer.from_pretrained(MODEL_DIR)
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
s = "한국의 수도는 어디?"
conversation = [{'role': 'user', 'content': s}]
inputs = tokenizer.apply_chat_template(
conversation,
tokenize=True,
add_generation_prompt=True,
return_tensors='pt').to("cuda")
_ = model.generate(inputs, streamer=streamer, max_new_tokens=1024)
hf (pretrained=chihoonlee10/T3Q-LLM-MG-v1.0), limit: None, provide_description: False, num_fewshot: 0, batch_size: None
| Task | Version | Metric | Value | Stderr | |
|---|---|---|---|---|---|
| kobest_boolq | 0 | acc | 0.9523 | ± | 0.0057 |
| macro_f1 | 0.9523 | ± | 0.0057 | ||
| kobest_copa | 0 | acc | 0.7740 | ± | 0.0132 |
| macro_f1 | 0.7737 | ± | 0.0133 | ||
| kobest_hellaswag | 0 | acc | 0.4980 | ± | 0.0224 |
| acc_norm | 0.5920 | ± | 0.0220 | ||
| macro_f1 | 0.4950 | ± | 0.0223 | ||
| kobest_sentineg | 0 | acc | 0.7254 | ± | 0.0224 |
| macro_f1 | 0.7106 | ± | 0.0234 |
| Task | Version | Metric | Value | Stderr | |
|---|---|---|---|---|---|
| kobest_boolq | 0 | acc | 0.9387 | ± | 0.0064 |
| macro_f1 | 0.9387 | ± | 0.0064 | ||
| kobest_copa | 0 | acc | 0.7590 | ± | 0.0135 |
| macro_f1 | 0.7585 | ± | 0.0135 | ||
| kobest_hellaswag | 0 | acc | 0.5080 | ± | 0.0224 |
| acc_norm | 0.5580 | ± | 0.0222 | ||
| macro_f1 | 0.5049 | ± | 0.0224 | ||
| kobest_sentineg | 0 | acc | 0.8489 | ± | 0.0180 |
| macro_f1 | 0.8483 | ± | 0.0180 |