Text Generation
Transformers
Safetensors
Chinese
English
yunmo_next
chat
traditional-chinese
hybrid-attention
kimi-delta-attention
linear-attention
research
custom_code
Instructions to use yuhuanstudio/Yunmo-Next-1B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yuhuanstudio/Yunmo-Next-1B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yuhuanstudio/Yunmo-Next-1B-Instruct", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("yuhuanstudio/Yunmo-Next-1B-Instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yuhuanstudio/Yunmo-Next-1B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yuhuanstudio/Yunmo-Next-1B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yuhuanstudio/Yunmo-Next-1B-Instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/yuhuanstudio/Yunmo-Next-1B-Instruct
- SGLang
How to use yuhuanstudio/Yunmo-Next-1B-Instruct 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 "yuhuanstudio/Yunmo-Next-1B-Instruct" \ --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": "yuhuanstudio/Yunmo-Next-1B-Instruct", "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 "yuhuanstudio/Yunmo-Next-1B-Instruct" \ --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": "yuhuanstudio/Yunmo-Next-1B-Instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use yuhuanstudio/Yunmo-Next-1B-Instruct with Docker Model Runner:
docker model run hf.co/yuhuanstudio/Yunmo-Next-1B-Instruct
Download code/yunmo_next/training_engine.py from yuhuanstudio/Yunmo-Next-1B-Instruct: direct link, hf CLI and curl.
- Browser
- Download file 3.93 kB
-
https://huggingface.co/yuhuanstudio/Yunmo-Next-1B-Instruct/resolve/main/code/yunmo_next/training_engine.py
- Command line
-
hf download hf://yuhuanstudio/Yunmo-Next-1B-Instruct/code/yunmo_next/training_engine.py
-
curl -L -o training_engine.py https://huggingface.co/yuhuanstudio/Yunmo-Next-1B-Instruct/resolve/main/code/yunmo_next/training_engine.py
3.93 kB
| """Strict execution settings kept separate from Yunmo-Next model geometry. | |
| The type records how one training process executes an already-defined model. | |
| It intentionally has no context-to-stage inference and no production route | |
| table; stage recipes must select an engine explicitly. | |
| """ | |
| from __future__ import annotations | |
| from dataclasses import asdict, dataclass, fields | |
| from typing import Any, Mapping | |
| class TrainingEngineConfig: | |
| """Stage-independent training execution schema.""" | |
| feed_forward_chunk_tokens: int = 0 | |
| feed_forward_serial_backward: bool = False | |
| recurrent_segment_tokens: int = 0 | |
| recurrent_packed_documents: bool = False | |
| recurrent_official_forward_serial_backward: bool = False | |
| activation_checkpointing: bool = True | |
| activation_checkpoint_mode: str = "non_reentrant" | |
| cross_entropy_backend: str = "liger" | |
| def __post_init__(self) -> None: | |
| for name in ("feed_forward_chunk_tokens", "recurrent_segment_tokens"): | |
| value = getattr(self, name) | |
| if type(value) is not int: | |
| raise TypeError(f"{name} must be int, got {type(value).__name__}") | |
| if value < 0: | |
| raise ValueError(f"{name} must be non-negative") | |
| for name in ( | |
| "feed_forward_serial_backward", | |
| "recurrent_packed_documents", | |
| "recurrent_official_forward_serial_backward", | |
| "activation_checkpointing", | |
| ): | |
| value = getattr(self, name) | |
| if type(value) is not bool: | |
| raise TypeError(f"{name} must be bool, got {type(value).__name__}") | |
| for name in ("activation_checkpoint_mode", "cross_entropy_backend"): | |
| value = getattr(self, name) | |
| if type(value) is not str: | |
| raise TypeError(f"{name} must be str, got {type(value).__name__}") | |
| if ( | |
| self.feed_forward_serial_backward | |
| and self.feed_forward_chunk_tokens == 0 | |
| ): | |
| raise ValueError( | |
| "serial feed-forward backward requires a positive chunk size" | |
| ) | |
| if ( | |
| self.recurrent_segment_tokens | |
| and self.recurrent_segment_tokens % 64 | |
| ): | |
| raise ValueError("recurrent segment size must be a multiple of 64") | |
| if self.recurrent_packed_documents and self.recurrent_segment_tokens == 0: | |
| raise ValueError( | |
| "packed recurrent execution requires a positive segment size" | |
| ) | |
| if ( | |
| self.recurrent_official_forward_serial_backward | |
| and not self.recurrent_packed_documents | |
| ): | |
| raise ValueError( | |
| "official-forward serial-backward recurrent execution " | |
| "requires packed documents" | |
| ) | |
| if self.activation_checkpoint_mode != "non_reentrant": | |
| raise ValueError( | |
| "Yunmo-Next training uses non-reentrant activation checkpointing" | |
| ) | |
| if self.cross_entropy_backend not in {"liger", "pytorch"}: | |
| raise ValueError( | |
| "cross_entropy_backend must be liger or pytorch" | |
| ) | |
| def to_dict(self) -> dict[str, Any]: | |
| return asdict(self) | |
| def from_dict(cls, value: Mapping[str, Any]) -> "TrainingEngineConfig": | |
| if not isinstance(value, Mapping): | |
| raise TypeError("TrainingEngineConfig must be loaded from a mapping") | |
| expected = {field.name for field in fields(cls)} | |
| actual = set(value) | |
| if actual != expected: | |
| raise ValueError( | |
| "TrainingEngineConfig field set changed: " | |
| f"missing={sorted(expected - actual)}, " | |
| f"extra={sorted(actual - expected)}" | |
| ) | |
| return cls(**dict(value)) | |
| TRAINING_ENGINE_CONFIG_FIELDS = tuple( | |
| field.name for field in fields(TrainingEngineConfig) | |
| ) | |