Instructions to use kfkas/Llama-2-ko-7b-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kfkas/Llama-2-ko-7b-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kfkas/Llama-2-ko-7b-Chat")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kfkas/Llama-2-ko-7b-Chat") model = AutoModelForCausalLM.from_pretrained("kfkas/Llama-2-ko-7b-Chat", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kfkas/Llama-2-ko-7b-Chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kfkas/Llama-2-ko-7b-Chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kfkas/Llama-2-ko-7b-Chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/kfkas/Llama-2-ko-7b-Chat
- SGLang
How to use kfkas/Llama-2-ko-7b-Chat 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 "kfkas/Llama-2-ko-7b-Chat" \ --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": "kfkas/Llama-2-ko-7b-Chat", "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 "kfkas/Llama-2-ko-7b-Chat" \ --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": "kfkas/Llama-2-ko-7b-Chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use kfkas/Llama-2-ko-7b-Chat with Docker Model Runner:
docker model run hf.co/kfkas/Llama-2-ko-7b-Chat
Prompt 문의
Chat 버전으로 Finetune 하실 때, Prompt format을 어떻게 하셨는지 궁금합니다.
KuLLM의 포맷을 사용하였습니다
Prompt template라고 표현하는게 더 맞는 것 같습니다.
Llama2-chat 모델의 경우, 아래와 같은 서식을 사용하는 것으로 알고 있습니다. (https://gpus.llm-utils.org/llama-2-prompt-template/)
<s>[INST] <<SYS>>
{your_system_message}
<</SYS>>
{user_message_1} [/INST]
KuLLM의 포맷을 사용하셨다는 말은 위 서식의 {your_system_message}에 Instruction 열 내용을, {user_message_1}에 Input 열 내용을 대입하셨다는 말씀이실까요?
{
"description": "Alpaca-LoRA에서 사용하는 템플릿입니다.",
"prompt_input": "아래는 작업을 설명하는 명령어와 추가 컨텍스트를 제공하는 입력이 짝을 이루는 예제입니다. 요청을 적절히 완료하는 응답을 작성하세요.\n\n### 명령어:\n{instruction}\n\n### 입력:\n{input}\n\n### 응답:\n",
"prompt_no_input": "아래는 작업을 설명하는 명령어입니다. 요청을 적절히 완료하는 응답을 작성하세요.\n\n### 명령어:\n{instruction}\n\n### 응답:\n",
"response_split": "### 응답:"
}
이런식입니다.
감사합니다!