Dart v3 Preview
Collection
6 items • Updated • 3
How to use p1atdev/dart-v3-pretrain-preview-E with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="p1atdev/dart-v3-pretrain-preview-E") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("p1atdev/dart-v3-pretrain-preview-E")
model = AutoModelForCausalLM.from_pretrained("p1atdev/dart-v3-pretrain-preview-E")How to use p1atdev/dart-v3-pretrain-preview-E with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "p1atdev/dart-v3-pretrain-preview-E"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "p1atdev/dart-v3-pretrain-preview-E",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/p1atdev/dart-v3-pretrain-preview-E
How to use p1atdev/dart-v3-pretrain-preview-E with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "p1atdev/dart-v3-pretrain-preview-E" \
--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": "p1atdev/dart-v3-pretrain-preview-E",
"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 "p1atdev/dart-v3-pretrain-preview-E" \
--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": "p1atdev/dart-v3-pretrain-preview-E",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use p1atdev/dart-v3-pretrain-preview-E with Docker Model Runner:
docker model run hf.co/p1atdev/dart-v3-pretrain-preview-E
- name: v3 pretrain preview E
version: v3
model_name_or_path: p1atdev/dart-v3-pretrain-preview-E
model_type: eager
prompt_template_id: V3_PRETRAIN
RATING = Literal["<|rating:general|>", "<|rating:sensitive|>", "<|rating:questionable|>", <|rating:explicit|>]
ASPECT_RATIO = Literal[
"<|aspect_ratio:too_tall|>",
"<|aspect_ratio:tall_wallpaper|>",
"<|aspect_ratio:tall|>",
"<|aspect_ratio:square|>",
"<|aspect_ratio:wide|>",
"<|aspect_ratio:wide_wallpaper|>",
"<|aspect_ratio:too_tall|>"
]
LENGTH = Literal["<|length:very_short|>", "<|length:medium|>", "<|length:very_long|>"]
template = (
"<|bos|>"
"{rating}{aspect_ratio}{length}"
"<copyright>{copyright}</copyright>"
"<character>{character}</character>"
"<general>{condition}"
)
# for example:
prompt = template.format(
rating="<|rating:general|>", # RATING
aspect_ratio="<|aspect_ratio:tall|>", # ASPECT_RATIO
length="<|length:medium|>", # LENGTH
copyright="original",
character="my character",
condition="1girl",
)