Instructions to use beomi/Yi-Ko-34B-Chat-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use beomi/Yi-Ko-34B-Chat-Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="beomi/Yi-Ko-34B-Chat-Preview") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("beomi/Yi-Ko-34B-Chat-Preview") model = AutoModelForCausalLM.from_pretrained("beomi/Yi-Ko-34B-Chat-Preview") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use beomi/Yi-Ko-34B-Chat-Preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "beomi/Yi-Ko-34B-Chat-Preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "beomi/Yi-Ko-34B-Chat-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/beomi/Yi-Ko-34B-Chat-Preview
- SGLang
How to use beomi/Yi-Ko-34B-Chat-Preview 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 "beomi/Yi-Ko-34B-Chat-Preview" \ --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": "beomi/Yi-Ko-34B-Chat-Preview", "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 "beomi/Yi-Ko-34B-Chat-Preview" \ --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": "beomi/Yi-Ko-34B-Chat-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use beomi/Yi-Ko-34B-Chat-Preview with Docker Model Runner:
docker model run hf.co/beomi/Yi-Ko-34B-Chat-Preview
beomi/Yi-Ko-34B-Chat-Preview (feat. ChatVector)
This repo is naive ChatVector applied using these 3 models:
ko_model_id = 'beomi/Yi-Ko-34B'
chat_model = '01-ai/Yi-34B-Chat'
base_model = '01-ai/Yi-34B'
Benchmarks
| Tasks | Version | Filter | n-shot | Metric | Value | Stderr | |
|---|---|---|---|---|---|---|---|
| kobest_boolq | 1 | none | 5 | acc | 0.9174 | ยฑ | 0.0074 |
| none | 5 | f1 | 0.9174 | ยฑ | N/A | ||
| kobest_copa | 1 | none | 5 | acc | 0.8620 | ยฑ | 0.0109 |
| none | 5 | f1 | 0.8618 | ยฑ | N/A | ||
| kobest_hellaswag | 1 | none | 5 | acc | 0.5260 | ยฑ | 0.0224 |
| none | 5 | f1 | 0.5243 | ยฑ | N/A | ||
| none | 5 | acc_norm | 0.5920 | ยฑ | 0.0220 | ||
| kobest_sentineg | 1 | none | 5 | acc | 0.9874 | ยฑ | 0.0056 |
| none | 5 | f1 | 0.9874 | ยฑ | N/A |
Samples
messages = [
{"role": "system", "content": "์น์ ํ ์ฑ๋ด์ผ๋ก์ ์๋๋ฐฉ์ ์์ฒญ์ ์ต๋ํ ์์ธํ๊ณ ์น์ ํ๊ฒ ๋ตํ์. ๋ชจ๋ ๋๋ต์ ํ๊ตญ์ด(Korean)์ผ๋ก ๋๋ตํด์ค."},
{"role": "user", "content": "์ด์์ ์ฅ๊ตฐ์ ๋ํด ์ค๋ช
ํด์ค."},
]
---
์ด์์ ์ฅ๊ตฐ์ ์กฐ์ ์๋์ ํ์ฝํ ์ ๋ช
ํ ์์ง์๋์ ์ ๋ต๊ฐ์. ๊ทธ๊ฐ ํ์ฝํ ์๊ธฐ๋ 16์ธ๊ธฐ ๋ง์ด์์ผ๋ฉฐ, ์ด๋๋ ์ผ๋ณธ์ด ์กฐ์ ์ ์นจ๋ตํ๋ ์์ง์๋์ด ๋ฐ๋ฐํ ๋์
๋๋ค. ์ด์์ ์ฅ๊ตฐ์ ์ด๋ ์ผ๋ณธ์ ํด๊ตฐ์ผ๋ก ๊ตฌ์ฑ๋ ๊ตฐ๋๊ฐ ์กฐ์ ์ ๊ณต๊ฒฉํ์, ์กฐ์ ์ ํด๊ตฐ์์ ํ์ฝํ๋ฉฐ ์ผ๋ณธ์ ์๋ํ์ต๋๋ค. ์ ๋ช
ํ ํด์ ์ธ 'ํ์ฐ๋๋์ฒฉ'๊ณผ '๋ช
๋๋์ฒฉ'์์ ์ด์์ ์ฅ๊ตฐ์ ๋ฐ์ด๋ ์ ๋ต๊ณผ ์ฉ๊ธฐ๋ก ์ผ๋ณธ์ ์๋๋ก ํฌ๊ฒ ์น๋ฆฌํ๋ ๋ฑ ์กฐ์ ์ ์๊ธฐ์์ ๊ตฌํ ์ค์ํ ์ธ๋ฌผ๋ก ํ๊ฐ๋ฐ๊ณ ์์ต๋๋ค. ๊ทธ์ ์ฉ๊ธฐ์ ์ง๋ต์ ํ์ฌ๊น์ง๋ ๋ง์ ์ฌ๋๋ค์ ๊ท๊ฐ์ผ๋ก ์ ํด์ง๊ณ ์์ต๋๋ค<|im_end|>
messages = [
{"role": "system", "content": "์น์ ํ ์ฑ๋ด์ผ๋ก์ ์๋๋ฐฉ์ ์์ฒญ์ ์ต๋ํ ์์ธํ๊ณ ์น์ ํ๊ฒ ๋ตํ์. ๋ชจ๋ ๋๋ต์ ํ๊ตญ์ด(Korean)์ผ๋ก ๋๋ตํด์ค."},
{"role": "user", "content": "๋
๋์ ๋ค์ผ์๋ง์ ์ฐจ์ด๊ฐ ๋ญ์ผ?"},
]
---
"๋
๋"์ "๋ค์ผ์๋ง"๋ ๋์ผํ ์ฌ์ ๊ฐ๋ฆฌํค๋ ์ด๋ฆ์ด์ง๋ง ์๋ก ๋ค๋ฅธ ๋๋ผ์ ์ธ์ด๋ก ๋ถ๋ฆฌ๊ณ ์์ต๋๋ค. "๋
๋"๋ ๋ํ๋ฏผ๊ตญ ์ด๋ก "็จๅณถ"๋ผ๊ณ ๋ถ๋ฅด๋ฉฐ, "๋ค์ผ์๋ง"๋ ์ผ๋ณธ ์ด๋ก "็ซนๅณถ"๋ผ๊ณ ๋ถ๋ฆ
๋๋ค. ์ด ์ฌ์ ์ผ๋ณธ ๋ํ ๋ฆฌํ๊ณผ ์ฌ์นด์ด๋ฏธ๋ํ ์์ ์ธ์ ํ ์ผ๋ณธ์ ๊ฐ๊น์ด ๊ณณ์ ์์นํด ์์ง๋ง, ๊ตญ์ ๋ฒ์ ์ผ๋ก ๋ํ๋ฏผ๊ตญ์ ์ํ ๋ก ์ธ์ ๋ฐ๊ณ ์์ต๋๋ค.
๋ํ๋ฏผ๊ตญ์ ์ด ์ฌ์ ๋
๋๋ก ์นญํ๋ฉฐ ์ญ์ฌ์ ์ผ๋ก๋ถํฐOwnership๋ฅผ ์ฃผ์ฅํ๊ณ ์์ต๋๋ค. ์ญ์ฌ์ ๊ธฐ๋ก์ ๋ฐ๋ฅด๋ฉด ๋
๋๋ ์กฐ์ ์๋์ ์ด๋ฏธ ํ๊ตญ์ ์ํ ๋ก ์ธ์๋์๊ณ , ์ผ๋ณธ ์ ๊ตญ์ฃผ์ ์์ ์ ์ ์ ๊ดํ ๊ถ์ ์ํ๋ค๊ฐ ์ผ๋ณธ์ด ํจ์ ํ ์ดํ ๋ํ๋ฏผ๊ตญ ์ํ ๋ก ํ์๋์์ต๋๋ค.
์ผ๋ณธ์ ์ด ์ฌ์ ๋ค์ผ์๋ง๋ก ์นญํ๋ฉฐ ์์ ๊ถ์ ์ฃผ์ฅํ๊ณ ์์ต๋๋ค. ํ์ง๋ง, ์ด๋ฌํ ์ฃผ์ฅ์ ๊ตญ์ ๋ฒ์ ์ธ์ ๋์ง ์์ผ๋ฉฐ, ํ๊ตญ ์ ๋ถ๋ ๋
๋๋ฅผ ๋ํ๋ฏผ๊ตญ์ ์ํ ๋ก์ ์ ๋์ ์ธ ๊ถ๋ฆฌ๋ฅผ ๊ฐ์ง๊ณ ์์์ ๋ถ๋ช
ํ ํ๊ณ ์์ต๋๋ค.
๊ฒฐ๋ก ์ ์ผ๋ก, "๋
๋"์ "๋ค์ผ์๋ง"๋ ๋์ผํ ์ฌ์ ๊ฐ๋ฆฌํค์ง๋ง, ์๋ก ๋ค๋ฅธ ๊ตญ๊ฐ์ ์ญ์ฌ์ ์ด๊ณ ์ ์น์ ์ํฉ์ ๋ฐ๋ผ ๋ถ๋ฅด๋ ์ด๋ฆ์ด ๋ค๋ฅด๋ฉฐ, ๊ตญ์ ๋ฒ์ ์ด ์ฌ์ ๋ํ๋ฏผ๊ตญ์ ์ํ ๋ก ๋ถ๋ฅ๋๊ณ ์์ต๋๋ค.<|im_end|>
messages = [
{"role": "system", "content": "์น์ ํ ์ฑ๋ด์ผ๋ก์ ์๋๋ฐฉ์ ์์ฒญ์ ์ต๋ํ ์์ธํ๊ณ ์น์ ํ๊ฒ ๋ตํ์. ๋ชจ๋ ๋๋ต์ ํ๊ตญ์ด(Korean)์ผ๋ก ๋๋ตํด์ค."},
{"role": "user", "content": "์ธ์ข
๋์์ ์งํ์ ๋งฅ๋ถ ๋์ง ์ฌ๊ฑด์ ๋ํด์ ์๊ณ ์์ด?"},
]
---
์ธ์ข
๋์์ ์งํ์ ๋งฅ๋ถ ๋์ง ์ฌ๊ฑด์ ๋ํด ๋ค์ด๋ณธ ์ ์ด ์์ต๋๋ค. ์ด ์ฌ๊ฑด์ 2017๋
ํ ๋ฐฉ์ก์ฌ์ ๋๋ผ๋ง์์ ๋ฑ์ฅํ๋ฉฐ ๋๋ฆฌ ์๋ ค์ก๋๋ฐ์, ๋๋ผ๋ง์์๋ ์งํ์ ํ์๋ค์ด ์๋ก์ด ๋ฌธ๋ฌผ์ธ ๋งฅ๋ถ์ ๋ณด๊ณ ์ธ์ข
๋์์ด ์ด๋ฅผ ๋์ง ๊ฒ์ผ๋ก ๋ฌ์ฌ๋์ด ๋
ผ๋์ด ๋์์ต๋๋ค.
ํ์ง๋ง ์ด ๋ด์ฉ์ ์ญ์ฌ์ ์ฌ์ค๊ณผ ๋ค๋ฅด๋ค๋ ๊ฒ์ด ๋ฐํ์ก์ต๋๋ค. ์งํ์ ํ์๋ค์ด ์ค์ ๋ก ๋งฅ๋ถ๊ณผ ๊ฐ์ ์ธ๊ณ ๋ฌธ๋ฌผ์ ๋ชฉ๊ฒฉํ์ ๋ฆฌ ์๊ณ , ์ธ์ข
๋์์ด ํ์๋ค์ ๋
ธ๋ ฅ์ ํํํ๊ฑฐ๋ ๋ฌผ๊ฑด์ ๋์ง๋ ํ๋์ ํ์ ๊ฒ์ด๋ผ๋ ์ ์ ์ ๋ฌธ์ ๊ฐ ์์์ต๋๋ค. ์คํ๋ ค ์ธ์ข
๋์์ ์๋ช
ํ์ ์ค๋ฆฝํ๊ณ ํ๊ธ์ ์ฐฝ์ ํ๋ ๋ฑ ํ๋ฌธ๊ณผ ๋ฌธํ์ ๋ํ ์ง์์ ์๊น์ง ์์๋ ๊ฒ์ผ๋ก ์๋ ค์ ธ ์์ต๋๋ค.
๋๋ผ๋ง ์์ ๋ฑ์ฅํ ์ฌ๊ฑด์ ํ๊ตฌ์ ์ธ ์ค์ ์ผ๋ฟ, ์ค์ ์ญ์ฌ์์ ์ผ์ด๋ ์ผ์ ์๋๋๋ค. ์ด๋ฌํ ์ค๋ฅ๋ฅผ ๋ฐ์ํ๋ฏ, ์ดํ์ ๋ฐฉ์ก์์๋ ํด๋น ์ฅ๋ฉด์ด ์์ ๋๊ฑฐ๋ ์ญ์ ๋์์ต๋๋ค.<|im_end|>
messages = [
{"role": "system", "content": "์น์ ํ ์ฑ๋ด์ผ๋ก์ ์๋๋ฐฉ์ ์์ฒญ์ ์ต๋ํ ์์ธํ๊ณ ์น์ ํ๊ฒ ๋ตํ์. ๋ชจ๋ ๋๋ต์ ํ๊ตญ์ด(Korean)์ผ๋ก ๋๋ตํด์ค."},
{"role": "user", "content": "๋๋ ์ค๋ ์ฌ๊ณผ 5๊ฐ๋ฅผ ๊ฐ๊ณ ์์ด. ๊ทธ๋ฆฌ๊ณ ์ด์ ๋๋ ์ฌ๊ณผ 2๊ฐ๋ฅผ ๋จน์์ง. ๋ด๊ฐ ์ง๊ธ ๊ฐ์ง ์ฌ๊ณผ๋ ๋ช ๊ฐ์ง?"},
]
---
์ง๋ ๋ฒ์๋ ์ฌ๊ณผ 2๊ฐ๋ฅผ ๋จน์๊ณ , ์ง๊ธ์ ์ฌ๊ณผ 5๊ฐ๋ฅผ ๊ฐ๊ณ ์๋ค๊ณ ํ์ผ๋, ์ง๊ธ ๊ฐ์ง ์ฌ๊ณผ์ ๊ฐ์๋ 5๊ฐ์
๋๋ค. ๊ทธ๋ฐ๋ฐ, ์ฌ๊ณผ 2๊ฐ๋ฅผ ๋จน์ด์ ์ด ์ฌ๊ณผ๋ฅผ 5๊ฐ์์ 2๊ฐ ๋นผ๋ฉด, ๋จ์ ์ฌ๊ณผ์ ๊ฐ์๋ 5 - 2 = 3๊ฐ์
๋๋ค. ๊ทธ๋ฌ๋๊น, ์ง๊ธ ๊ฐ์ง ์ฌ๊ณผ๋ 3๊ฐ์
๋๋ค.<|im_end|>
beomi/Yi-Ko-34B-Preview
Yi-Ko series models serve as advanced iterations of 01-ai/Yi models, benefiting from an expanded vocabulary and the inclusion of Korean/English corpus in its further pretraining. Just like its predecessor, Yi-Ko series models operate within the broad range of generative text models that stretch from 6 billion to 34 billion parameters. This repository focuses on the 34B pretrained version, which is tailored to fit the Hugging Face Transformers format. For access to the other models, feel free to consult the index provided below.
Model Details
Model Developers Junbum Lee (Beomi)
Variations Yi-Ko-34B will come in a range of parameter sizes โ 6B and 34B โ with Ko(Korean Only)/KoEn(Korean+English)/KoEnCo(Korean+English+Code) variations.
Input Models input text only.
Output Models generate text only.
Model Architecture
Yi-Ko series models are an auto-regressive language model that uses an optimized transformer architecture based on Llama-2*.
*Yi model architecture is based on Llama2, so it can be loaded via LlamaForCausalLM class on HF.
| Model Name | Training Data | Params | Context Length | GQA | Trained Tokens | LR | Batch Size(per step) |
|---|---|---|---|---|---|---|---|
| Yi-Ko-34B | A mix of Korean + English online data | 34B | 4k | O | TBD(under training) | 5e-5 | 2048 |
Vocab Expansion
| Model Name | Vocabulary Size | Description |
|---|---|---|
| Original Yi-Series | 64000 | Sentencepiece BPE |
| Expanded Yi-Ko Series | 78464 | Sentencepiece BPE. Added Korean vocab and merges |
Tokenizing "์๋ ํ์ธ์, ์ค๋์ ๋ ์จ๊ฐ ์ข๋ค์.ใ ใ "
| Model | # of tokens | Tokens |
|---|---|---|
| Original Yi-Series | 47 | ['<0xEC>', '<0x95>', '<0x88>', '<0xEB>', '<0x85>', '<0x95>', 'ํ', '<0xEC>', '<0x84>', '<0xB8>', '<0xEC>', '<0x9A>', '<0x94>', ',', 'โ', '<0xEC>', '<0x98>', '<0xA4>', '<0xEB>', '<0x8A>', '<0x98>', '์', 'โ', '<0xEB>', '<0x82>', '<0xA0>', '<0xEC>', '<0x94>', '<0xA8>', '๊ฐ', 'โ', '<0xEC>', '<0xA2>', '<0x8B>', '<0xEB>', '<0x84>', '<0xA4>', '<0xEC>', '<0x9A>', '<0x94>', '.', '<0xE3>', '<0x85>', '<0x8E>', '<0xE3>', '<0x85>', '<0x8E>'] |
| Expanded Yi-Ko Series | 10 | ['โ์๋
', 'ํ์ธ์', ',', 'โ์ค๋์', 'โ๋ ', '์จ๊ฐ', 'โ์ข๋ค์', '.', 'ใ
', 'ใ
'] |
| *Equal Korean vocab with Llama-2-Ko Series |
Tokenizing "Llama 2: Open Foundation and Fine-Tuned Chat Models"
| Model | # of tokens | Tokens |
|---|---|---|
| Original Yi-Series | 21 | ['The', 'โY', 'i', 'โseries', 'โmodels', 'โare', 'โlarge', 'โlanguage', 'โmodels', 'โtrained', 'โfrom', 'โscratch', 'โby', 'โdevelopers', 'โat', 'โ', '0', '1', '.', 'AI', '.'] |
| Expanded Yi-Ko Series | 21 | ['โThe', 'โY', 'i', 'โseries', 'โmodels', 'โare', 'โlarge', 'โlanguage', 'โmodels', 'โtrained', 'โfrom', 'โscratch', 'โby', 'โdevelopers', 'โat', 'โ', '0', '1', '.', 'AI', '.'] |
| *Equal Korean vocab with Llama-2-Ko Series | *Since Expanded Yi-Ko Series prepends _ at the beginning of the text(to ensure same tokenization for Korean sentences), it shows negilible difference for the first token on English tokenization. |
Model Benchmark
LM Eval Harness - Korean (polyglot branch)
TBD
LICENSE
CC-BY-NC-SA-4.0 under Yi license
Citation
TBD
Acknowledgement
The training is supported by TPU Research Cloud program.
- Downloads last month
- 7