Instructions to use etri-xainlp/polyglot-ko-12.8b-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use etri-xainlp/polyglot-ko-12.8b-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="etri-xainlp/polyglot-ko-12.8b-instruct")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("etri-xainlp/polyglot-ko-12.8b-instruct") model = AutoModelForCausalLM.from_pretrained("etri-xainlp/polyglot-ko-12.8b-instruct", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use etri-xainlp/polyglot-ko-12.8b-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "etri-xainlp/polyglot-ko-12.8b-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "etri-xainlp/polyglot-ko-12.8b-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/etri-xainlp/polyglot-ko-12.8b-instruct
- SGLang
How to use etri-xainlp/polyglot-ko-12.8b-instruct 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 "etri-xainlp/polyglot-ko-12.8b-instruct" \ --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": "etri-xainlp/polyglot-ko-12.8b-instruct", "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 "etri-xainlp/polyglot-ko-12.8b-instruct" \ --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": "etri-xainlp/polyglot-ko-12.8b-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use etri-xainlp/polyglot-ko-12.8b-instruct with Docker Model Runner:
docker model run hf.co/etri-xainlp/polyglot-ko-12.8b-instruct
polyglot-ko-12.8b-instruct
This model is a fine-tuned version of EleutherAI/polyglot-ko-12.8b on an instruction-following dataset(260k).
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 5e-05
- train_batch_size: 1
- seed: 42
- distributed_type: multi-GPU(A100 80G)
- num_devices: 8
- gradient_accumulation_steps: 64
- total_train_batch_size: 512
- total_eval_batch_size: 64
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 5.0
Inference
import torch
from transformers import pipeline, AutoModelForCausalLM
MODEL = 'etri-xainlp/polyglot-ko-12.8b-instruct'
model = AutoModelForCausalLM.from_pretrained(
MODEL,
torch_dtype=torch.float16,
low_cpu_mem_usage=True,
).to(device=f"cuda", non_blocking=True)
model.eval()
pipe = pipeline(
'text-generation',
model=model,
tokenizer=MODEL,
device=0
)
pipe.model.config.pad_token_id = pipe.model.config.eos_token_id
def ask(x, context='', is_input_full=False):
ans = pipe(
f"### ์ง๋ฌธ: {x}\n\n### ๋งฅ๋ฝ: {context}\n\n### ๋ต๋ณ:" if context else f"### ์ง๋ฌธ: {x}\n\n### ๋ต๋ณ:",
do_sample=True,
max_new_tokens=2048,
temperature=0.9,
top_p=0.9,
return_full_text=False,
eos_token_id=2,
)
return ans[0]['generated_text']
while True:
quit = input('prompt?: ')
if quit == 'q':
break
else:
generation = ask(quit)
print("etri_ai:", generation)
Framework versions
- Transformers 4.30.2
- Pytorch 2.0.1+cu118
- Datasets 2.13.1
- Tokenizers 0.13.3
- Downloads last month
- 9