huytd189/pintora-edit-instruct
Viewer • Updated • 500 • 43
How to use huytd189/pintora-coder-7b with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="huytd189/pintora-coder-7b") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("huytd189/pintora-coder-7b")
model = AutoModelForCausalLM.from_pretrained("huytd189/pintora-coder-7b")How to use huytd189/pintora-coder-7b with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "huytd189/pintora-coder-7b"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "huytd189/pintora-coder-7b",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/huytd189/pintora-coder-7b
How to use huytd189/pintora-coder-7b with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "huytd189/pintora-coder-7b" \
--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": "huytd189/pintora-coder-7b",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "huytd189/pintora-coder-7b" \
--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": "huytd189/pintora-coder-7b",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use huytd189/pintora-coder-7b with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for huytd189/pintora-coder-7b to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for huytd189/pintora-coder-7b to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for huytd189/pintora-coder-7b to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="huytd189/pintora-coder-7b",
max_seq_length=2048,
)How to use huytd189/pintora-coder-7b with Docker Model Runner:
docker model run hf.co/huytd189/pintora-coder-7b
Pintora-Coder-7B is a fine-tuned version of Qwen2.5-Coder-7B to support the Pintora diagram language.
The model supports the following features:
The model has been trained in the following steps:
Example 1: Generate diagram from scratch
Instruction:
Create a component diagram for a platform to buy and sell games between users.
Output code:
componentDiagram
package "Services" {
[Game Service]
[User Service]
}
database "Storage" {
[Games Table]
[Users Table]
}
[Game Service] --> [Games Table]
[User Service] --> [Users Table]
[Game Service] --> [User Service] : for authentication
Preview:
Example 2: Edit existing diagram
Instruction:
Add shopping cart and checkout service to this component diagram
componentDiagram
package "Services" {
[Game Service]
[User Service]
}
database "Storage" {
[Games Table]
[Users Table]
}
[Game Service] --> [Games Table]
[User Service] --> [Users Table]
[Game Service] --> [User Service] : for authentication
Output code:
componentDiagram
package "Services" {
[Game Service]
[User Service]
[Shopping Cart Service]
[Checkout Service]
}
database "Storage" {
[Games Table]
[Users Table]
[Cart Items Table]
[Orders Table]
}
[Game Service] --> [Games Table]
[User Service] --> [Users Table]
[Shopping Cart Service] --> [Cart Items Table]
[Checkout Service] --> [Cart Items Table]
[Checkout Service] --> [Orders Table]
[Game Service] --> [User Service] : for authentication
[Shopping Cart Service] --> [User Service] : for authentication
[Checkout Service] --> [User Service] : for authentication
Preview:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model
model_name = "huytd189/pintora-coder-7b"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, device_map="auto")
# Prompt template
edit_prompt = """Pintora Diagram Edit Instruction
### Instruction:
{}
{}
### Response:
{}"""
# Example 1: Generate from scratch
inputs = tokenizer([
edit_prompt.format(
"Create a component diagram for a platform to buy and sell games between users.",
"",
""
)
], return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512, use_cache=True)
print(tokenizer.batch_decode(outputs, skip_special_tokens=True)[0])
print("\n" + "="*80 + "\n")
# Example 2: Edit existing diagram
inputs = tokenizer([
edit_prompt.format(
"Add shopping cart and checkout service to this component diagram",
"""componentDiagram
package "Services" {
[Game Service]
[User Service]
}
database "Storage" {
[Games Table]
[Users Table]
}
[Game Service] --> [Games Table]
[User Service] --> [Users Table]
[Game Service] --> [User Service] : for authentication""",
""
)
], return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512, use_cache=True)
print(tokenizer.batch_decode(outputs, skip_special_tokens=True)[0])