Janeodum/diagramify-tikz-dataset
Viewer • Updated • 5.59k • 16
How to use Janeodum/diagramify-tikz-lora with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-7B-Instruct")
model = PeftModel.from_pretrained(base_model, "Janeodum/diagramify-tikz-lora")How to use Janeodum/diagramify-tikz-lora with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Janeodum/diagramify-tikz-lora")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Janeodum/diagramify-tikz-lora")
model = AutoModelForCausalLM.from_pretrained("Janeodum/diagramify-tikz-lora", 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=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use Janeodum/diagramify-tikz-lora with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Janeodum/diagramify-tikz-lora"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Janeodum/diagramify-tikz-lora",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Janeodum/diagramify-tikz-lora
How to use Janeodum/diagramify-tikz-lora with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Janeodum/diagramify-tikz-lora" \
--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": "Janeodum/diagramify-tikz-lora",
"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 "Janeodum/diagramify-tikz-lora" \
--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": "Janeodum/diagramify-tikz-lora",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Janeodum/diagramify-tikz-lora with Docker Model Runner:
docker model run hf.co/Janeodum/diagramify-tikz-lora
axolotl version: 0.13.0.dev0
adapter: lora
base_model: Qwen/Qwen2.5-Coder-7B-Instruct
bf16: auto
datasets:
- path: Janeodum/diagramify-tikz-dataset
type: chat_template
gradient_accumulation_steps: 4
learning_rate: 0.0001
load_in_8bit: false
load_in_4bit: true
lora_alpha: 64
lora_dropout: 0.05
lora_r: 32
lora_target_modules:
- q_proj
- v_proj
- k_proj
- o_proj
- gate_proj
- down_proj
- up_proj
micro_batch_size: 2
num_epochs: 1
optimizer: adamw_bnb_8bit
output_dir: ./outputs/mymodel
sequence_len: 2048
train_on_inputs: false
This model is a fine-tuned version of Qwen/Qwen2.5-Coder-7B-Instruct on the Janeodum/diagramify-tikz-dataset dataset.
More information needed
More information needed
More information needed
The following hyperparameters were used during training: