Text Generation
Transformers
Safetensors
Russian
English
zarya
feature-extraction
dllm
diffusion
diffusion-language-modeling
instruct
conversational
custom_code
Instructions to use ai-forever/Zarya-1.7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ai-forever/Zarya-1.7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ai-forever/Zarya-1.7B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ai-forever/Zarya-1.7B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ai-forever/Zarya-1.7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ai-forever/Zarya-1.7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ai-forever/Zarya-1.7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ai-forever/Zarya-1.7B
- SGLang
How to use ai-forever/Zarya-1.7B 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 "ai-forever/Zarya-1.7B" \ --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": "ai-forever/Zarya-1.7B", "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 "ai-forever/Zarya-1.7B" \ --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": "ai-forever/Zarya-1.7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ai-forever/Zarya-1.7B with Docker Model Runner:
docker model run hf.co/ai-forever/Zarya-1.7B
Download generation_utils.py from ai-forever/Zarya-1.7B: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/ai-forever/Zarya-1.7B/resolve/main/generation_utils.py
- Command line
-
hf download hf://ai-forever/Zarya-1.7B/generation_utils.py
-
curl -L -o generation_utils.py https://huggingface.co/ai-forever/Zarya-1.7B/resolve/main/generation_utils.py
1.17 kB
| from transformers.generation.configuration_utils import GenerationConfig | |
| from transformers.utils import logging | |
| logger = logging.get_logger(__name__) | |
| class ZaryaGenerationConfig(GenerationConfig): | |
| model_type = "zarya" | |
| ignore_noise_schedule: bool = False | |
| def __init__(self, **kwargs): | |
| super().__init__(**kwargs) | |
| self.ignore_noise_schedule: bool = kwargs.pop("ignore_noise_schedule", False) | |
| self.T: int = kwargs.pop("T", 1000) | |
| self.use_float64: bool = kwargs.pop("use_float64", False) | |
| self.sequential_phase_only: bool = kwargs.pop("sequential_phase_only", False) | |
| self.diffusion_phase_only: bool = kwargs.pop("diffusion_phase_only", False) | |
| self.unmask_probs_coef: float = kwargs.pop("unmask_probs_coef", 1) | |
| self.slot_size: int = kwargs.pop("slot_size", 16) | |
| self.serial_num_blocks: int = kwargs.pop("serial_num_blocks", 1) | |
| self.slot_threshold: float = kwargs.pop("slot_threshold", 0.9) | |
| self.token_threshold: float = kwargs.pop("token_threshold", 0.3) | |
| # Validate the values of the attributes | |
| self.validate(strict=True) | |
| __all__ = ["ZaryaGenerationConfig"] | |