Text Generation
Transformers
Safetensors
PyTorch
English
muddpythia
causal-lm
muddformer
custom_code
Instructions to use Caiyun-AI/MUDDPythia-2.8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Caiyun-AI/MUDDPythia-2.8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Caiyun-AI/MUDDPythia-2.8B", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Caiyun-AI/MUDDPythia-2.8B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Caiyun-AI/MUDDPythia-2.8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Caiyun-AI/MUDDPythia-2.8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Caiyun-AI/MUDDPythia-2.8B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Caiyun-AI/MUDDPythia-2.8B
- SGLang
How to use Caiyun-AI/MUDDPythia-2.8B 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 "Caiyun-AI/MUDDPythia-2.8B" \ --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": "Caiyun-AI/MUDDPythia-2.8B", "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 "Caiyun-AI/MUDDPythia-2.8B" \ --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": "Caiyun-AI/MUDDPythia-2.8B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Caiyun-AI/MUDDPythia-2.8B with Docker Model Runner:
docker model run hf.co/Caiyun-AI/MUDDPythia-2.8B
Download configuration_muddpythia.py from Caiyun-AI/MUDDPythia-2.8B: direct link, hf CLI and curl.
- Browser
- Download file 2.63 kB
-
https://huggingface.co/Caiyun-AI/MUDDPythia-2.8B/resolve/main/configuration_muddpythia.py
- Command line
-
hf download hf://Caiyun-AI/MUDDPythia-2.8B/configuration_muddpythia.py
-
curl -L -o configuration_muddpythia.py https://huggingface.co/Caiyun-AI/MUDDPythia-2.8B/resolve/main/configuration_muddpythia.py
2.63 kB
| from transformers.configuration_utils import PretrainedConfig | |
| from typing import Optional | |
| class MUDDPythiaConfig(PretrainedConfig): | |
| model_type = "muddpythia" | |
| ''' | |
| MUDDPythiaConfig is a config class for MUDDPythia, which is adpated from https://github.com/pytorch-labs/gpt-fast/blob/main/model.py#L21 | |
| ''' | |
| def __init__( | |
| self, | |
| block_size: int = 2048, | |
| vocab_size: int = 32000, | |
| n_layer: int = 32, | |
| n_head: int = 32, | |
| dim: int = 2560, | |
| intermediate_size: int = None, | |
| n_local_heads: int = -1, | |
| head_dim: int = 64, | |
| rope_base: float = 10000, | |
| norm_eps: float = 1e-5, | |
| use_gradient_checkpointing: bool = False, | |
| is_training: bool = False, | |
| use_qk_norm: bool = False , | |
| pad_token_id: Optional[int]= None, | |
| use_parallel_residual: bool =True, | |
| use_linear_bias: bool = True, | |
| rotary_pct: float = 0.25, | |
| bos_token_id: int =1, | |
| eos_token_id: int =2, | |
| tie_word_embeddings: bool =False, | |
| use_layer_cache: bool = True, | |
| dense: bool = True, | |
| dynamic_dense: bool = True, | |
| sepln: bool = True, | |
| dense_type: str = 'qkvr', | |
| expand_last: bool = False, | |
| round64: bool = False, | |
| **kwargs, | |
| ): | |
| self.block_size=block_size | |
| self.vocab_size=vocab_size | |
| self.n_layer=n_layer | |
| self.n_head=n_head | |
| self.dim=dim | |
| self.intermediate_size=intermediate_size | |
| self.n_local_heads=n_local_heads | |
| self.head_dim=head_dim | |
| self.rope_base=rope_base | |
| self.norm_eps=norm_eps | |
| self.use_gradient_checkpointing=use_gradient_checkpointing | |
| self.is_training=is_training | |
| self.use_qk_norm=use_qk_norm | |
| self.use_parallel_residual = use_parallel_residual | |
| self.use_linear_bias = use_linear_bias | |
| self.rotary_pct = rotary_pct | |
| self.use_layer_cache= use_layer_cache | |
| self.dense= dense | |
| self.dynamic_dense= dynamic_dense | |
| self.sepln= sepln | |
| self.dense_type=dense_type | |
| self.expand_last= expand_last | |
| self.round64 = round64 | |
| # post init | |
| if self.n_local_heads == -1: | |
| self.n_local_heads = self.n_head | |
| if self.intermediate_size is None: | |
| self.intermediate_size = 4 * self.dim | |
| self.head_dim = self.dim // self.n_head | |
| super().__init__( | |
| pad_token_id=pad_token_id, | |
| bos_token_id=bos_token_id, | |
| eos_token_id=eos_token_id, | |
| tie_word_embeddings=tie_word_embeddings, | |
| **kwargs, | |
| ) | |