Instructions to use sjbaek/gemma2-2b-it-korean-dialect with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sjbaek/gemma2-2b-it-korean-dialect with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sjbaek/gemma2-2b-it-korean-dialect") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sjbaek/gemma2-2b-it-korean-dialect") model = AutoModelForCausalLM.from_pretrained("sjbaek/gemma2-2b-it-korean-dialect", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sjbaek/gemma2-2b-it-korean-dialect with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sjbaek/gemma2-2b-it-korean-dialect" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sjbaek/gemma2-2b-it-korean-dialect", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sjbaek/gemma2-2b-it-korean-dialect
- SGLang
How to use sjbaek/gemma2-2b-it-korean-dialect 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 "sjbaek/gemma2-2b-it-korean-dialect" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sjbaek/gemma2-2b-it-korean-dialect", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "sjbaek/gemma2-2b-it-korean-dialect" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sjbaek/gemma2-2b-it-korean-dialect", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sjbaek/gemma2-2b-it-korean-dialect with Docker Model Runner:
docker model run hf.co/sjbaek/gemma2-2b-it-korean-dialect
๐ Model Card for Model ID
Gemma2 2b ํ๊ตญ์ด ๋ฐฉ์ธ ํต์ญ๊ธฐ v0.2.0
๐ Model Description
Gemma2 2b ํ๊ตญ์ด ๋ฐฉ์ธ ํต์ญ๊ธฐ๋ ํ๊ตญ์ด ์ฌํฌ๋ฆฌ๋ฅผ ํ์ค์ด๋ก ๋ฒ์ญํ๊ฑฐ๋ ํ์ค์ด๋ฅผ ํ๊ตญ์ด ์ฌํฌ๋ฆฌ๋ก ๋ณํํ๋ ํ๋ก์ ํธ์ ์ผํ์ผ๋ก ๊ฐ๋ฐ๋ ๋ชจ๋ธ์ ๋๋ค.
Gemma2 2b it ๋ชจ๋ธ์ ์ฌ์ฉํ์ฌ ๊ฐ๋ ฅํ ์์ฐ์ด ์ฒ๋ฆฌ ๊ธฐ๋ฅ์ ์ ๊ณตํ๋ฉฐ, QLoRa ๊ธฐ๋ฒ์ผ๋ก ํ์ธํ๋ํ์ฌ ์ ์๋์์ต๋๋ค.
์ํ LLM์ ์ฌ์ฉํจ์ผ๋ก์จ, ๋น์ฉ ๋๋น ํจ๊ณผ์ ์ธ ๋ฐฉ์์ผ๋ก ์ฌํฌ๋ฆฌ ๋ณํ ์ฑ๋ฅ์ ๋ฌ์ฑํ ์ ์์ต๋๋ค.
๐ ์ฌ์ฉ์ฒ | Uses
์ด ๋ชจ๋ธ์ ํ๊ตญ์ด ๋ฐฉ์ธ์ ํ์ค ํ๊ตญ์ด๋ก ๋ฒ์ญํ๊ฑฐ๋ ๊ทธ ๋ฐ๋๋ก ๋ฒ์ญํ๋ ๋ฐ ์ง์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์์ฑ ์ธ์ ๋ฐ ๋ฒ์ญ ๋๊ตฌ๋ฅผ ๊ฐ๋ฐํ๋ ๊ต์ก์, ์ธ์ดํ์, ๊ฐ๋ฐ์์๊ฒ ์ ์ฉํ ์ ์์ต๋๋ค.
โ๏ธ ์์ | Examples
| ์ ๋ ฅ ๋ฌธ์ฅ | ๋ฐฉ์ธ: ๊ฒ๋ ์ ์ด๋จธ๋ ๋ ๋์ด ๋จน์ด๊ฐ๊ธฐ ์ ์ ์ฌ๊ธฐ ์์ผ ๋ ๊ฑด๋ | ํ์ค์ด: ๊ทธ๋ฌ๋๊น ์ ์ด๋จธ๋ ๋ ๋์ด ๋จน์ด๊ฐ๊ธฐ ์ ์ ์ฌ๊ธฐ ์์ผ ๋ ๊ฑด๋ฐ |
|---|---|---|
| ๋ฐฉ์ธ ํต์ญ๊ธฐ ์ถ๋ ฅ | ํ์ค์ด: ๊ทธ๋ฌ๋๊น ์ ์ด๋จธ๋ ๋ ๋์ด ๋จน์ด๊ฐ๊ธฐ ์ ์ ์ฌ๊ธฐ ์์ผ ๋ ๊ฑด๋ฐ | ๋ฐฉ์ธ: ๊ฒ๋ ์ ์ด๋ฉ ๋ ๋์ด ๋จน์ด๊ฐ๊ธฐ ์ ์ ์ฌ๊ธฐ ์์ผ ๋ ๊ฑด๋ |
| ์ ๋ ฅ ๋ฌธ์ฅ | ๋ฐฉ์ธ: ์์ด ํด์ ๋ ์ ๋ง ๋ ๊ฑฐ ๋ณด๋ ์ธ ์์ด์ฐ๋ค | ํ์ค์ด: ์ฌ ํ์ ๋ญ์ด์ด ๋ง ๋ ๊ฑฐ ๋ณด๋, ์ถ์ด ๋ชจ์์ด๋ค |
|---|---|---|
| ๋ฐฉ์ธ ํต์ญ๊ธฐ ์ถ๋ ฅ | ํ์ค์ด: ์ค ํ์ ๋ญ์ด์ด ๋ง์ด ๋ ๊ฑฐ ๋ณด๋๊น ์ถ์ด ๋ชจ์์ ๋๋ค | ๋ฐฉ์ธ: ์ฌ ํด์ ๋ ์ ๋ง ๋ ๊ฑฐ ๋ณด๋ ์ธ ์์ด์ฐ๋ค |
โ ๏ธ ํ๊ณ์ | Bias, Risks, and Limitations
์ด ๋ชจ๋ธ์ ํ์ฌ ์ ์ฃผ ๋ฐฉ์ธ์ ์ด์ ์ ๋ง์ถ ํน์ ๋ฐ์ดํฐ ์ธํธ์ ๋ง์ถฐ ๋ฏธ์ธ ์กฐ์ ๋์๊ธฐ ๋๋ฌธ์ ๋ค๋ฅธ ๋ฐฉ์ธ์ด๋ ์ธ์ด์ ๋ํ ์ฑ๋ฅ์ด ์ ํ๋ ์ ์์ต๋๋ค.
ํฅํ ๋ฒ์ ์์ ๋ค์ํ ๋ฐฉ์ธ์ ๋ํ ์ง์์ ์ถ๊ฐํ ์์ ์ ๋๋ค.(์ถฉ์ฒญ, ์ ๋ผ, ๊ฒฝ์, ๊ฐ์)
๐ ์ฌ์ฉ๋ฒ | How to Get Started with the Model
import transformers
import torch
model_id = "sjbaek/gemma2-2b-it-korean-dialect"
tokenizer = transformers.AutoTokenizer.from_pretrained(model_id, add_eos_token=True)
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
tokenizer=tokenizer,
torch_dtype=torch.float16,
device_map="auto",
max_new_tokens = 512,
)
def dialect_to_standard(text, dialect_type):
return [
{
"role":"user",
"content": "Convert the following sentence or word which is {}'s dialect to standard Korean:\n\n{}".format(dialect_type, text)
}
]
def standard_to_dialect(text, dialect_type):
return [
{
"role":"user",
"content": "Convert the following sentence or word which is standard Korean to {}'s dialect :\n\n{}".format(dialect_type, text)
}
]
outputs = pipeline(
dialect_to_standard("์ฐ๋ฆฌ ๋์๋ ์๋ฒ์ ์์์ผ๋ ๋ฏธ๊นก ํ์นด๋ถ๋ ๋ด๋ ค์๋น ๋ชป ํ๋", "์ ์ฃผ๋"),
do_sample=True,
temperature=0.1,
top_p=0.90,
add_special_tokens=True
)
print(outputs[0]["generated_text"][-1])
# {'role': 'assistant', 'content': '์ฐ๋ฆฌ ๋์๋ ์๋ฒ์ ์์์ผ๋ ๊ทค ํ๊ณ ์๋ค๊ฐ ๋ชป ํ๋๊น'}
outputs = pipeline(
standard_to_dialect("๊ทธ๋ฌ๋๊น ์ ์ด๋จธ๋ ๋ ๋์ด ๋จน์ด๊ฐ๊ธฐ ์ ์ ์ฌ๊ธฐ ์์ผ ๋ ๊ฑด๋ฐ", "์ ์ฃผ๋"),
do_sample=True,
temperature=0.1,
top_p=0.90,
add_special_tokens=True
)
print(outputs[0]["generated_text"][-1])
# {'role': 'assistant', 'content': '๊ฒ๋ ์ ์ด๋ฉ ๋ ๋์ด ๋จน์ด๊ฐ๊ธฐ ์ ์ ์ฌ๊ธฐ ์์ผ ๋ ๊ฑด๋'}
๐ ์ฌ์ฉ ๋ฐ์ดํฐ์ | Training Data
๐ ํฅํ ๊ณํ | TO DO
- ์ถฉ์ฒญ๋ ๋ฐฉ์ธ ๋ณํ ๊ธฐ๋ฅ (v0.3.0)
- ์ ๋ผ๋ ๋ฐฉ์ธ ๋ณํ ๊ธฐ๋ฅ (v0.4.0)
- ๊ฒฝ์๋ ๋ฐฉ์ธ ๋ณํ ๊ธฐ๋ฅ (v0.5.0)
- ๊ฐ์๋ ๋ฐฉ์ธ ๋ณํ ๊ธฐ๋ฅ (v1.0.0)
- Downloads last month
- 35