Text Generation
Transformers
Safetensors
Korean
English
aether_micro
Mixture of Experts
mixture-of-experts
custom
aether
latent-thought
multi-token-prediction
custom_code
Instructions to use Be2Jay/AETHER-Micro-0.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Be2Jay/AETHER-Micro-0.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Be2Jay/AETHER-Micro-0.5B", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Be2Jay/AETHER-Micro-0.5B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Be2Jay/AETHER-Micro-0.5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Be2Jay/AETHER-Micro-0.5B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Be2Jay/AETHER-Micro-0.5B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Be2Jay/AETHER-Micro-0.5B
- SGLang
How to use Be2Jay/AETHER-Micro-0.5B 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 "Be2Jay/AETHER-Micro-0.5B" \ --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": "Be2Jay/AETHER-Micro-0.5B", "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 "Be2Jay/AETHER-Micro-0.5B" \ --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": "Be2Jay/AETHER-Micro-0.5B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Be2Jay/AETHER-Micro-0.5B with Docker Model Runner:
docker model run hf.co/Be2Jay/AETHER-Micro-0.5B
| #!/usr/bin/env python3 | |
| """ | |
| AETHER-Micro Helper Functions | |
| 재사용 가능한 유틸리티 함수들 | |
| """ | |
| import torch | |
| def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: | |
| """ | |
| Repeat K/V heads for Grouped Query Attention (GQA) | |
| Args: | |
| hidden_states: (batch, num_kv_heads, seq_len, head_dim) | |
| n_rep: num_heads // num_kv_heads | |
| Returns: | |
| (batch, num_heads, seq_len, head_dim) | |
| """ | |
| batch, num_key_value_heads, slen, head_dim = hidden_states.shape | |
| if n_rep == 1: | |
| return hidden_states | |
| hidden_states = hidden_states[:, :, None, :, :].expand( | |
| batch, num_key_value_heads, n_rep, slen, head_dim | |
| ) | |
| return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim) | |
| def rotate_half(x): | |
| """Rotates half the hidden dims of the input.""" | |
| x1 = x[..., : x.shape[-1] // 2] | |
| x2 = x[..., x.shape[-1] // 2 :] | |
| return torch.cat((-x2, x1), dim=-1) | |
| def apply_rotary_pos_emb(q, k, cos, sin, position_ids): | |
| """ | |
| Apply Rotary Position Embedding to Q and K | |
| Args: | |
| q: query states (batch, num_heads, seq_len, head_dim) | |
| k: key states (batch, num_kv_heads, seq_len, head_dim) | |
| cos: cosine values (batch, seq_len, head_dim) | |
| sin: sine values (batch, seq_len, head_dim) | |
| position_ids: position indices (batch, seq_len) | |
| Returns: | |
| q_embed, k_embed: rotated query and key | |
| """ | |
| # Gather cos/sin based on position_ids | |
| cos = cos.squeeze(1).squeeze(0) # (seq_len, head_dim) | |
| sin = sin.squeeze(1).squeeze(0) | |
| cos = cos[position_ids].unsqueeze(1) # (batch, 1, seq_len, head_dim) | |
| sin = sin[position_ids].unsqueeze(1) | |
| q_embed = (q * cos) + (rotate_half(q) * sin) | |
| k_embed = (k * cos) + (rotate_half(k) * sin) | |
| return q_embed, k_embed | |