davidkim205/ko_common_gen
Viewer • Updated • 4.53k • 9 • 1
How to use chlee10/T3Q-ko-solar-sft-v3.0 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="chlee10/T3Q-ko-solar-sft-v3.0")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("chlee10/T3Q-ko-solar-sft-v3.0")
model = AutoModelForCausalLM.from_pretrained("chlee10/T3Q-ko-solar-sft-v3.0")
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=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use chlee10/T3Q-ko-solar-sft-v3.0 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "chlee10/T3Q-ko-solar-sft-v3.0"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "chlee10/T3Q-ko-solar-sft-v3.0",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/chlee10/T3Q-ko-solar-sft-v3.0
How to use chlee10/T3Q-ko-solar-sft-v3.0 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "chlee10/T3Q-ko-solar-sft-v3.0" \
--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": "chlee10/T3Q-ko-solar-sft-v3.0",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "chlee10/T3Q-ko-solar-sft-v3.0" \
--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": "chlee10/T3Q-ko-solar-sft-v3.0",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use chlee10/T3Q-ko-solar-sft-v3.0 with Docker Model Runner:
docker model run hf.co/chlee10/T3Q-ko-solar-sft-v3.0
Update @ 2024.03.25
This model is a SFT fine-tuned version of chihoonlee10/T3Q-ko-solar-dpo-v3.0
Model Developers Chihoon Lee(chlee10), T3Q
The following hyperparameters were used during training:
# 데이터셋과 훈련 횟수와 관련된 하이퍼 파라미터
batch_size = 16
num_epochs = 1
micro_batch = 1
gradient_accumulation_steps = batch_size // micro_batch
# 훈련 방법에 대한 하이퍼 파라미터
cutoff_len = 4096
lr_scheduler = 'cosine'
warmup_ratio = 0.06 # warmup_steps = 100
learning_rate = 5e-5
optimizer = 'paged_adamw_32bit'
weight_decay = 0.01
max_grad_norm = 1.0
# LoRA config
lora_r = 16
lora_alpha = 16
lora_dropout = 0.05
lora_target_modules = ["k_proj", "v_proj","gate_proj", "down_proj", "up_proj"]
# Tokenizer에서 나오는 input값 설정 옵션
train_on_inputs = False
add_eos_token = False
# NEFTune params
neftune_noise_alpha = 5