HasturOfficial/adgen
Viewer • Updated • 116k • 192 • 11
How to use snowfly/glm3-QLoRA-adgen with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="snowfly/glm3-QLoRA-adgen", trust_remote_code=True)
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("snowfly/glm3-QLoRA-adgen", trust_remote_code=True, dtype="auto")How to use snowfly/glm3-QLoRA-adgen with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "snowfly/glm3-QLoRA-adgen"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "snowfly/glm3-QLoRA-adgen",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/snowfly/glm3-QLoRA-adgen
How to use snowfly/glm3-QLoRA-adgen with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "snowfly/glm3-QLoRA-adgen" \
--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": "snowfly/glm3-QLoRA-adgen",
"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 "snowfly/glm3-QLoRA-adgen" \
--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": "snowfly/glm3-QLoRA-adgen",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use snowfly/glm3-QLoRA-adgen with Docker Model Runner:
docker model run hf.co/snowfly/glm3-QLoRA-adgen
在ChatGLM3-6B模型上使用QLoRA在HasturOfficial/adgen数据集上进行广告生成微调
HasturOfficial/adgen是广告生成数据集
from transformers import AutoTokenizer, AutoModel
model_name_or_path = "snowfly/glm3-QLoRA-adgen"
tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path=model_name_or_path, trust_remote_code=True)
model = AutoModel.from_pretrained(pretrained_model_name_or_path=model_name_or_path, trust_remote_code=True, device='cuda')
model = model.eval()
input_text = '类型#裙*版型#显瘦*风格#文艺*风格#简约*图案#印花*图案#撞色*裙下摆#压褶*裙长#连衣裙*裙领型#圆领'
response, history = model.chat(tokenizer=tokenizer, query=input_text, history=[])
print(response)