Instructions to use colable/llama-ko-peft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use colable/llama-ko-peft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="colable/llama-ko-peft")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("colable/llama-ko-peft") model = AutoModelForCausalLM.from_pretrained("colable/llama-ko-peft") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use colable/llama-ko-peft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "colable/llama-ko-peft" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "colable/llama-ko-peft", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/colable/llama-ko-peft
- SGLang
How to use colable/llama-ko-peft 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 "colable/llama-ko-peft" \ --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": "colable/llama-ko-peft", "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 "colable/llama-ko-peft" \ --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": "colable/llama-ko-peft", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use colable/llama-ko-peft with Docker Model Runner:
docker model run hf.co/colable/llama-ko-peft
Update README.md
Browse files
README.md
CHANGED
|
@@ -7,4 +7,30 @@ language:
|
|
| 7 |
# open-llama-2-ko based model with inhouse dataset
|
| 8 |
|
| 9 |
This is an Korean Model based on
|
| 10 |
-
* [beomi/open-llama-2-ko-7b]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# open-llama-2-ko based model with inhouse dataset
|
| 8 |
|
| 9 |
This is an Korean Model based on
|
| 10 |
+
* [beomi/open-llama-2-ko-7b]
|
| 11 |
+
|
| 12 |
+
gpu code example
|
| 13 |
+
|
| 14 |
+
```
|
| 15 |
+
import torch
|
| 16 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 17 |
+
import math
|
| 18 |
+
|
| 19 |
+
## v2 models
|
| 20 |
+
model_path = "colable/llama-ko-peft"
|
| 21 |
+
|
| 22 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, use_default_system_prompt=False)
|
| 23 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 24 |
+
model_path, torch_dtype=torch.float32, device_map='auto',local_files_only=False, load_in_4bit=True
|
| 25 |
+
)
|
| 26 |
+
print(model)
|
| 27 |
+
prompt = input("please input prompt:")
|
| 28 |
+
while len(prompt) > 0:
|
| 29 |
+
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to("cuda")
|
| 30 |
+
|
| 31 |
+
generation_output = model.generate(
|
| 32 |
+
input_ids=input_ids, max_new_tokens=500,repetition_penalty=1.2
|
| 33 |
+
)
|
| 34 |
+
print(tokenizer.decode(generation_output[0]))
|
| 35 |
+
prompt = input("please input prompt:")
|
| 36 |
+
```
|