KONI
Collection
Text-only LLMs • 9 items • Updated
How to use KISTI-KONI/KONI-Llama3-8B-Instruct-20240729 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="KISTI-KONI/KONI-Llama3-8B-Instruct-20240729")
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("KISTI-KONI/KONI-Llama3-8B-Instruct-20240729")
model = AutoModelForCausalLM.from_pretrained("KISTI-KONI/KONI-Llama3-8B-Instruct-20240729", 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]:]))How to use KISTI-KONI/KONI-Llama3-8B-Instruct-20240729 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "KISTI-KONI/KONI-Llama3-8B-Instruct-20240729"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "KISTI-KONI/KONI-Llama3-8B-Instruct-20240729",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/KISTI-KONI/KONI-Llama3-8B-Instruct-20240729
How to use KISTI-KONI/KONI-Llama3-8B-Instruct-20240729 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "KISTI-KONI/KONI-Llama3-8B-Instruct-20240729" \
--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": "KISTI-KONI/KONI-Llama3-8B-Instruct-20240729",
"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 "KISTI-KONI/KONI-Llama3-8B-Instruct-20240729" \
--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": "KISTI-KONI/KONI-Llama3-8B-Instruct-20240729",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use KISTI-KONI/KONI-Llama3-8B-Instruct-20240729 with Docker Model Runner:
docker model run hf.co/KISTI-KONI/KONI-Llama3-8B-Instruct-20240729
Results in LogicKor* are as follows:
| Metric | Score |
|---|---|
| Reasoning | 6.57 |
| Math | 8.00 |
| Writing | 8.92 |
| Coding | 8.85 |
| Comprehension | 9.85 |
| Grammar | 7.07 |
| Single-turn | 8.42 |
| Multi-turn | 8.00 |
| Overall | 8.21 |
| Our model demonstrates the best performance among publicly available 8B models on the LogicKor leaderboard as of 2024.07.30. |
import transformers
import torch
model_id = "KISTI-KONI/KONI-Llama3-8B-Instruct-20240729"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
pipeline.model.eval()
instruction = "안녕? 너는 누구야?"
messages = [
{"role": "user", "content": f"{instruction}"}
]
prompt = pipeline.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
terminators = [
pipeline.tokenizer.eos_token_id,
pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = pipeline(
prompt,
max_new_tokens=2048,
eos_token_id=terminators,
do_sample=True,
temperature=0.7,
top_p=0.9
)
print(outputs[0]["generated_text"][len(prompt):])
안녕하세요! 저는 KONI, 여러분의 질문에 답하고 정보를 제공하는 인공지능입니다. 저는 어떤 정보를 제공해 드릴까요?
Language Model
@article{KISTI-KONI/KONI-Llama3-8B-Instruct-20240729,
title={KISTI-KONI/KONI-Llama3-8B-Instruct-20240729},
author={KISTI},
year={2024},
url={https://huggingface.co/KISTI-KONI/KONI-Llama3-8B-Instruct-20240729}
}