Instructions to use decula/sd with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use decula/sd with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-9B") model = PeftModel.from_pretrained(base_model, "decula/sd") - Transformers
How to use decula/sd with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="decula/sd")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("decula/sd", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use decula/sd with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "decula/sd" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "decula/sd", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/decula/sd
- SGLang
How to use decula/sd with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "decula/sd" \ --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": "decula/sd", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
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 "decula/sd" \ --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": "decula/sd", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use decula/sd with Docker Model Runner:
docker model run hf.co/decula/sd
| import os | |
| import pymysql | |
| db_config = { | |
| 'host': '192.168.100.188', | |
| 'user': 'root', | |
| 'password': 'Csiq@2019', | |
| 'db': 'porn', | |
| 'charset': 'utf8mb4', | |
| 'cursorclass': pymysql.cursors.DictCursor | |
| } | |
| # 连接到数据库 | |
| directory_path = 'C:\\games\\H\\h-corpus' | |
| # 遍历指定目录下的所有.txt文件 | |
| for filename in os.listdir(directory_path): | |
| if filename.endswith('.txt'): | |
| file_path = os.path.join(directory_path, filename) | |
| try: | |
| # 打开数据库连接 | |
| connection = pymysql.connect(max_allowed_packet=1024 * 1024 * 64, **db_config) | |
| with connection.cursor() as cursor: | |
| with open(file_path, 'r', encoding='utf-8') as file: | |
| title = file.readline().strip() # 读取标题 | |
| content = file.read().strip() # 读取内容 | |
| # 插入数据到数据库 | |
| sql = "INSERT INTO hnote (title, content) VALUES (%s, %s)" | |
| cursor.execute(sql, (title, content)) | |
| # 提交事务 | |
| connection.commit() | |
| except Exception as e: | |
| print(f"An error occurred: {e}") | |
| finally: | |
| # 关闭数据库连接 | |
| if connection: | |
| connection.close() | |
| print("All .txt files have been processed and inserted into the database.") |