jeiku/Writing
Viewer • Updated • 541 • 23
How to use hardlyworking/Sapphire-12B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="hardlyworking/Sapphire-12B")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("hardlyworking/Sapphire-12B")
model = AutoModelForCausalLM.from_pretrained("hardlyworking/Sapphire-12B")
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 hardlyworking/Sapphire-12B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "hardlyworking/Sapphire-12B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "hardlyworking/Sapphire-12B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/hardlyworking/Sapphire-12B
How to use hardlyworking/Sapphire-12B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "hardlyworking/Sapphire-12B" \
--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": "hardlyworking/Sapphire-12B",
"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 "hardlyworking/Sapphire-12B" \
--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": "hardlyworking/Sapphire-12B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use hardlyworking/Sapphire-12B with Docker Model Runner:
docker model run hf.co/hardlyworking/Sapphire-12B
axolotl version: 0.8.0
base_model: NewEden/MistralAI-Nemo-Instruct-ChatML
model_type: AutoModelForCausalLM
tokenizer_type: AutoTokenizer
load_in_8bit: false
load_in_4bit: false
strict: false
datasets:
- path: hardlyworking/HardlyRP
type: chat_template
chat_template: chatml
roles_to_train: ["gpt"]
field_messages: conversations
message_field_role: from
message_field_content: value
train_on_eos: turn
- path: jeiku/Writing
type: completion
field: text
shuffle_merged_datasets: true
dataset_prepared_path: dataset_preparedss
val_set_size: 0.0025
output_dir: 12b-out-0001-max_grad_norm
hub_model_id: hardlyworking/Sapphire-12B
hub_strategy: "all_checkpoints"
push_dataset_to_hub:
hf_use_auth_token: true
plugins:
- axolotl.integrations.liger.LigerPlugin
liger_rope: true
liger_rms_norm: true
liger_layer_norm: true
liger_glu_activation: true
liger_fused_linear_cross_entropy: true
sequence_len: 8192
sample_packing: true
eval_sample_packing: false
pad_to_sequence_len: true
max_grad_norm: 0.001
wandb_project: Sapphire
wandb_entity:
wandb_watch:
wandb_name: Sapphire
wandb_log_model:
evals_per_epoch: 8
eval_table_size:
eval_max_new_tokens: 128
gradient_accumulation_steps: 8
micro_batch_size: 2
num_epochs: 2
optimizer: adamw_bnb_8bit
lr_scheduler: cosine
learning_rate: 2e-6
train_on_inputs: false
group_by_length: false
bf16: auto
fp16:
tf32: false
gradient_checkpointing: true
early_stopping_patience:
resume_from_checkpoint:
local_rank:
logging_steps: 1
xformers_attention:
flash_attention: true
s2_attention:
warmup_ratio: 0.05
saves_per_epoch: 1
debug:
weight_decay: 0.0001
fsdp:
fsdp_config:
special_tokens:
pad_token: <pad>
This model is a fine-tuned version of NewEden/MistralAI-Nemo-Instruct-ChatML on the hardlyworking/HardlyRP and the jeiku/Writing datasets. It achieves the following results on the evaluation set:
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 1.8932 | 0.0033 | 1 | 1.9155 |
| 1.7729 | 0.1262 | 38 | 1.7802 |
| 1.7163 | 0.2525 | 76 | 1.7111 |
| 1.6484 | 0.3787 | 114 | 1.6970 |
| 1.7006 | 0.5050 | 152 | 1.6907 |
| 1.7276 | 0.6312 | 190 | 1.6874 |
| 1.7042 | 0.7575 | 228 | 1.6847 |
| 1.5575 | 0.8837 | 266 | 1.6825 |
| 1.5451 | 1.0100 | 304 | 1.6816 |
| 1.6592 | 1.1362 | 342 | 1.6807 |
| 1.7344 | 1.2625 | 380 | 1.6805 |
| 1.6953 | 1.3887 | 418 | 1.6798 |
| 1.5799 | 1.5150 | 456 | 1.6799 |
| 1.5241 | 1.6412 | 494 | 1.6799 |
| 1.548 | 1.7674 | 532 | 1.6797 |
| 1.6254 | 1.8937 | 570 | 1.6799 |
Base model
mistralai/Mistral-Nemo-Base-2407