Instructions to use beomi/open-llama-2-ko-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use beomi/open-llama-2-ko-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="beomi/open-llama-2-ko-7b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("beomi/open-llama-2-ko-7b") model = AutoModelForCausalLM.from_pretrained("beomi/open-llama-2-ko-7b") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use beomi/open-llama-2-ko-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "beomi/open-llama-2-ko-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "beomi/open-llama-2-ko-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/beomi/open-llama-2-ko-7b
- SGLang
How to use beomi/open-llama-2-ko-7b 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/open-llama-2-ko-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "beomi/open-llama-2-ko-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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/open-llama-2-ko-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "beomi/open-llama-2-ko-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use beomi/open-llama-2-ko-7b with Docker Model Runner:
docker model run hf.co/beomi/open-llama-2-ko-7b
Update Log
- 2023.12.14: Initial Release of Open-Llama-2-Ko
Open-Llama-2-Ko 🦙🇰🇷
Open-Llama-2-Ko represents an advanced iteration of the Llama 2 model, featuring an expanded vocabulary and the inclusion of a Korean corpus for enhanced pretraining. Similar to its predecessor, Llama-2-Ko, this model operates within the range of generative text models, with parameter counts ranging from 7 billion to 70 billion. The focus of this repository is on the 7B pretrained version, designed to integrate seamlessly with the Hugging Face Transformers format.
The primary distinction between the Llama-2-Ko Series and Open-Llama-2-Ko lies in the dataset. Open-Llama-2-Ko exclusively utilizes publicly accessible Korean corpora, including sources such as AI Hub, Modu Corpus, 모두의 말뭉치, and Korean Wikipedia.
As training was conducted solely with publicly available corpora, this model is open for unrestricted use by everyone, adhering to the MIT License*.
*MIT License under LLAMA 2 COMMUNITY LICENSE AGREEMENT
Model Details
Model Developers: Junbum Lee (Beomi)
Variations: Open-Llama-2-Ko will be available in different parameter sizes — 7B and 13B — along with various pretrained options.
Input: The model accepts only text input.
Output: The model produces text output exclusively.
Model Architecture:
Open-Llama-2-Ko is an auto-regressive language model that leverages an optimized transformer architecture derived from Llama-2.
| Training Data | Parameters | Content Length | GQA | Tokens | Learning Rate | |
|---|---|---|---|---|---|---|
| Llama 2 | A curated mix of Publicly Accessible Korean Corpora | 7B | 2k | ✘ | >15B* | 5e-5 |
Training Corpus
The model was trained using selected datasets from AIHub and Modu Corpus. Detailed information about the training datasets is available below:
- AI Hub: corpus/AI_HUB
- Only the
Trainingsegment of the data was used. - The
ValidationandTestsegments were deliberately excluded.
- Only the
- Modu Corpus: corpus/MODU_CORPUS
The final JSONL dataset used to train this model is approximately 61GB in size.
Total token count: Approximately 15 billion tokens (*using the expanded tokenizer. With the original Llama tokenizer, >60 billion tokens.)
Vocab Expansion
| Model Name | Vocabulary Size | Description |
|---|---|---|
| Original Llama-2 | 32000 | Sentencepiece BPE |
| Expanded Llama-2-Ko | 46336 | Sentencepiece BPE. Added Korean vocab and merges |
Tokenizing "안녕하세요, 오늘은 날씨가 좋네요."
| Model | Tokens |
|---|---|
| Llama-2 | ['▁', '안', '<0xEB>', '<0x85>', '<0x95>', '하', '세', '요', ',', '▁', '오', '<0xEB>', '<0x8A>', '<0x98>', '은', '▁', '<0xEB>', '<0x82>', '<0xA0>', '씨', '가', '▁', '<0xEC>', '<0xA2>', '<0x8B>', '<0xEB>', '<0x84>', '<0xA4>', '요'] |
| Llama-2-Ko | ['▁안녕', '하세요', ',', '▁오늘은', '▁날', '씨가', '▁좋네요'] |
Tokenizing "Llama 2: Open Foundation and Fine-Tuned Chat Models"
| Model | Tokens |
|---|---|
| Llama-2 | ['▁L', 'l', 'ama', '▁', '2', ':', '▁Open', '▁Foundation', '▁and', '▁Fine', '-', 'T', 'un', 'ed', '▁Ch', 'at', '▁Mod', 'els'] |
| Llama-2-Ko | ['▁L', 'l', 'ama', '▁', '2', ':', '▁Open', '▁Foundation', '▁and', '▁Fine', '-', 'T', 'un', 'ed', '▁Ch', 'at', '▁Mod', 'els'] |
LICENSE
MIT License under LLAMA 2 COMMUNITY LICENSE AGREEMENT
Model Benchmark
LM Eval Harness - Korean (polyglot branch)
- Used EleutherAI's lm-evaluation-harness https://github.com/EleutherAI/lm-evaluation-harness/tree/polyglot
TBD
Citation
TBD
Acknowledgements
- Training support was provided by the TPU Research Cloud program.
- The training corpus includes data from AI Hub, Modu Corpus, and Korean Wikipedia.
- Downloads last month
- 17