Instructions to use markdived/asg-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use markdived/asg-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="markdived/asg-v1", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("markdived/asg-v1", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use markdived/asg-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "markdived/asg-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "markdived/asg-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/markdived/asg-v1
- SGLang
How to use markdived/asg-v1 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 "markdived/asg-v1" \ --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": "markdived/asg-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "markdived/asg-v1" \ --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": "markdived/asg-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use markdived/asg-v1 with Docker Model Runner:
docker model run hf.co/markdived/asg-v1
File size: 903 Bytes
b7fa3e3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from __future__ import annotations
from typing import Any
from asg_transformer import ASGTransformer
_model: ASGTransformer | None = None
def load_model(model_dir: str = ".") -> ASGTransformer:
global _model
if _model is None:
_model = ASGTransformer.from_pretrained(model_dir)
return _model
def predict(inputs: dict[str, Any]) -> dict[str, Any]:
model = load_model()
text = inputs.get("text") or inputs.get("inputs")
if not isinstance(text, str) or not text.strip():
raise ValueError("A non-empty 'text' or 'inputs' field is required")
return model.generate(
text,
max_steps=inputs.get("max_steps"),
beam_width=inputs.get("beam_width"),
transition_weight=inputs.get("transition_weight"),
total_duration_minutes=inputs.get("total_duration_minutes"),
language=inputs.get("language", "en"),
).to_dict()
|