Instructions to use j5ng/kullm-5.8b-GPTQ-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use j5ng/kullm-5.8b-GPTQ-8bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="j5ng/kullm-5.8b-GPTQ-8bit")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("j5ng/kullm-5.8b-GPTQ-8bit") model = AutoModelForCausalLM.from_pretrained("j5ng/kullm-5.8b-GPTQ-8bit") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use j5ng/kullm-5.8b-GPTQ-8bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "j5ng/kullm-5.8b-GPTQ-8bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "j5ng/kullm-5.8b-GPTQ-8bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/j5ng/kullm-5.8b-GPTQ-8bit
- SGLang
How to use j5ng/kullm-5.8b-GPTQ-8bit 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 "j5ng/kullm-5.8b-GPTQ-8bit" \ --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": "j5ng/kullm-5.8b-GPTQ-8bit", "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 "j5ng/kullm-5.8b-GPTQ-8bit" \ --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": "j5ng/kullm-5.8b-GPTQ-8bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use j5ng/kullm-5.8b-GPTQ-8bit with Docker Model Runner:
docker model run hf.co/j5ng/kullm-5.8b-GPTQ-8bit
How to use GPTQ model
https://github.com/jongmin-oh/korean-LLM-quantize
Promter Download
mkdir ./templates && mkdir ./utils && wget -P ./templates https://raw.githubusercontent.com/jongmin-oh/korean-LLM-quantize/main/templates/kullm.json && wget -P ./utils https://raw.githubusercontent.com/jongmin-oh/korean-LLM-quantize/main/utils/prompter.py
install package
pip install torch==2.0.1 auto-gptq==0.4.2
- ๊ธํ์ ๋ถ๋ค์ ๋ฐ์ ์์ ์ฝ๋ ์คํํ์๋ฉด ๋ฐ๋ก ํ ์คํธ ๊ฐ๋ฅํฉ๋๋ค. (GPU memory 11GB ์ ์ )
- 2023-08-23์ผ ์ดํ๋ถํฐ๋ huggingFace์์ GPTQ๋ฅผ ๊ณต์์ง์ํ๊ฒ๋์์ต๋๋ค.
import torch
from transformers import pipeline
from auto_gptq import AutoGPTQForCausalLM
from utils.prompter import Prompter
MODEL = "j5ng/kullm-5.8b-GPTQ-8bit"
model = AutoGPTQForCausalLM.from_quantized(MODEL, device="cuda:0", use_triton=False)
pipe = pipeline('text-generation', model=model,tokenizer=MODEL)
prompter = Prompter("kullm")
def infer(instruction="", input_text=""):
prompt = prompter.generate_prompt(instruction, input_text)
output = pipe(
prompt, max_length=512,
temperature=0.2,
repetition_penalty=3.0,
num_beams=5,
eos_token_id=2
)
s = output[0]["generated_text"]
result = prompter.get_response(s)
return result
instruction = """
์ํฅ๋ฏผ(ํ๊ตญ ํ์: ๅญซ่ๆ
, 1992๋
7์ 8์ผ ~ )์ ๋ํ๋ฏผ๊ตญ์ ์ถ๊ตฌ ์ ์๋ก ํ์ฌ ์๊ธ๋๋ ํ๋ฆฌ๋ฏธ์ด๋ฆฌ๊ทธ ํ ํธ๋ ํ์คํผ์์ ์์ด๋ก ํ์ฝํ๊ณ ์๋ค.
๋ํ ๋ํ๋ฏผ๊ตญ ์ถ๊ตฌ ๊ตญ๊ฐ๋ํํ์ ์ฃผ์ฅ์ด์ 2018๋
์์์ ๊ฒ์ ๊ธ๋ฉ๋ฌ๋ฆฌ์คํธ์ด๋ฉฐ ์๊ตญ์์๋ ์ ์นญ์ธ "์๋"(Sonny)๋ก ๋ถ๋ฆฐ๋ค.
์์์ ์ ์๋ก์๋ ์ญ๋ ์ต์ด๋ก ํ๋ฆฌ๋ฏธ์ด๋ฆฌ๊ทธ ๊ณต์ ๋ฒ ์คํธ ์ผ๋ ๋ธ๊ณผ ์์์ ์ ์ ์ต์ด์ ํ๋ฆฌ๋ฏธ์ด๋ฆฌ๊ทธ ๋์ ์์ ๋ฌผ๋ก FIFA ํธ์ค์นด์ค์๊น์ง ํฉ์ธ์๊ณ 2022๋
์๋ ์ถ๊ตฌ ์ ์๋ก๋ ์ต์ด๋ก ์ฒด์กํ์ฅ ์ฒญ๋ฃก์ฅ ์ํ์๊ฐ ๋์๋ค.
์ํฅ๋ฏผ์ ํ์ฌ ๋ฆฌ๊ทธ 100ํธ๋ฅผ ๋ฃ์ด์ ํ์ ๊ฐ ๋๊ณ ์๋ค.
"""
result = infer(instruction=instruction, input_text="์ํฅ๋ฏผ์ ์ ์นญ์ ๋ญ์ผ?")
print(result) # ์ํฅ๋ฏผ์ ์ ์นญ์ Sonny์
๋๋ค.
Reference
- Downloads last month
- 3