Text Generation
Transformers
Safetensors
PyTorch
English
Korean
llama
facebook
meta
llama-3
llama-3-ko
conversational
text-generation-inference
Instructions to use Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6") 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("Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6") model = AutoModelForCausalLM.from_pretrained("Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6", 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6
- SGLang
How to use Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6 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 "Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6" \ --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": "Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6", "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 "Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6" \ --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": "Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6 with Docker Model Runner:
docker model run hf.co/Jsoo/Llama3-beomi-Open-Ko-8B-Instruct-preview-test6
Model Card for Model ID
Model Details
Llama-3-Open-Ko-8B model is continued pretrained language model based on Llama-3-8B.
This model is trained fully with publicily available resource, with 60GB+ of deduplicated texts.
With the new Llama-3 tokenizer, the pretraining conducted with 17.7B+ tokens, which slightly more than Korean tokenizer(Llama-2-Ko tokenizer).
Sample usage
from transformers import pipeline
import torch
pipe = pipeline(
task="text-generation",
model=model,
tokenizer=tokenizer,
model_kwargs={"torch_dtype": torch.bfloat16},
truncation=True
)
def extract_response_llama3(question):
messages = [
{"role": "system", "content": ""},
{"role": "user", "content": question},
]
prompt = pipe.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
terminators = [
pipe.tokenizer.eos_token_id,
pipe.tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = pipe(
prompt,
max_new_tokens=256,
eos_token_id=terminators,
do_sample=True,
temperature=0.1,
top_p=0.9,
num_return_sequences=1
)
return outputs[0]['generated_text'].split('\n')[-1]
question = "μμ°μ λΆλ°°ν λ μ¬μ
μ μ°μ μμλ₯Ό μ ν΄μ μ°¨λ± μ§μνλ λ°©λ²μ λλΌκ³ νμ§"
response = extract_response_llama3(question)
print(response)
question = "λ―ΈμΈλ¨Όμ§ μμ±λ¬Όμ§μ λ°°μΆμ μ κ°νκ³ μ’
ν©μ μΌλ‘ κ΄λ¦¬νκΈ° μν λ²μ μ΄λμ μ μ νλ"
response = extract_response_llama3(question)
print(response)
question = "μ΄λ€ μ₯μμ λκΈ°μ€μΌμ λ°©μ§νκΈ° μν μ μ±
μ λ²μ κ·Όκ±°κ° νΉλ³λ²μ μ μ μΌλ‘ μ€λΉλμμ§"
response = extract_response_llama3(question)
print(response)
Sample Output
μ νκ³Ό μ§μ€
νκ²½λΆ
νλ§
- Downloads last month
- 24