Instructions to use beomi/llama-2-ko-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use beomi/llama-2-ko-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="beomi/llama-2-ko-7b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("beomi/llama-2-ko-7b") model = AutoModelForCausalLM.from_pretrained("beomi/llama-2-ko-7b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use beomi/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/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/llama-2-ko-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/beomi/llama-2-ko-7b
- SGLang
How to use beomi/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/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/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/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/llama-2-ko-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use beomi/llama-2-ko-7b with Docker Model Runner:
docker model run hf.co/beomi/llama-2-ko-7b
LlamaTokenizer.from_pretrained 오류
# Load model directly
from transformers import LlamaTokenizer
tokenizer = LlamaTokenizer.from_pretrained("beomi/llama-2-ko-7b")
실행 시 아래와 같은 오류 발생:
```
TypeError Traceback (most recent call last)
in <cell line: 4>()
2 from transformers import LlamaTokenizer
3
----> 4 tokenizer = LlamaTokenizer.from_pretrained("beomi/llama-2-ko-7b")
1 frames
/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_base.py in _from_pretrained(cls, resolved_vocab_files, pretrained_model_name_or_path, init_configuration, token, cache_dir, local_files_only, _commit_hash, _is_local, *init_inputs, **kwargs)
2251 if added_tokens_map != {} and init_kwargs[key] is not None:
2252 if key != "additional_special_tokens":
-> 2253 init_kwargs[key] = added_tokens_map.get(init_kwargs[key], init_kwargs[key])
2254
2255 init_kwargs["added_tokens_decoder"] = added_tokens_decoder
TypeError: unhashable type: 'dict'
어떻게 해결하는지 알려주시면 감사하겠습니다 <3
12월 4일 현재 Note: this repo is under construction 라고 명시되어 있는데 그래서 오류가 발생하는 건가요?
https://huggingface.co/beomi/llama-2-ko-7b/discussions/4 이 쓰레드에 공유된 colab 노트북 코드를 보면 사용하신 LlamaTokenizer 가 아니라 AutoTokenizer 로 pretrained tokenizer를 불러왔습니다.
안녕하세요, 본 레포 가이드처럼 AutoTokenizer 를 통해 불러오셔야 합니다.