Text Generation
Transformers
Safetensors
English
Arabic
quasar_long
silx-ai
quasar-preview
quasar
foundation-model
Mixture of Experts
18b
2b-active
long-context
bittensor
sn24
decentralized-training
distillation
hybrid-transformer
loop-transformer
safe-nope
drope
conversational
custom_code
Instructions to use mainline777/base_IIXIV with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mainline777/base_IIXIV with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mainline777/base_IIXIV", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("mainline777/base_IIXIV", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mainline777/base_IIXIV with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mainline777/base_IIXIV" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mainline777/base_IIXIV", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mainline777/base_IIXIV
- SGLang
How to use mainline777/base_IIXIV 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 "mainline777/base_IIXIV" \ --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": "mainline777/base_IIXIV", "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 "mainline777/base_IIXIV" \ --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": "mainline777/base_IIXIV", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mainline777/base_IIXIV with Docker Model Runner:
docker model run hf.co/mainline777/base_IIXIV
| # Copyright (c) 2023-2024, Songlin Yang, Yu Zhang | |
| import torch | |
| import triton | |
| import triton.language as tl | |
| from fla.ops.utils.op import exp | |
| from fla.utils import IS_AMD, autotune_cache_kwargs | |
| NUM_WARPS_AUTOTUNE = [1, 2, 4, 8, 16] if IS_AMD else [1, 2, 4, 8, 16, 32] | |
| def softmax_fwd_kernel( | |
| x, | |
| p, | |
| D: tl.constexpr, | |
| B: tl.constexpr, | |
| ): | |
| i_n = tl.program_id(0) | |
| o_d = tl.arange(0, B) | |
| m_d = o_d < D | |
| b_x = tl.load(x + i_n * D + o_d, mask=m_d, other=-float('inf')) | |
| b_m = tl.max(b_x, 0) | |
| b_x = exp(b_x - b_m) | |
| b_p = b_x / tl.sum(b_x, 0) | |
| tl.store(p + i_n * D + o_d, b_p.to(p.dtype.element_ty), mask=m_d) | |
| def softmax_bwd_kernel( | |
| p, | |
| dp, | |
| ds, | |
| D: tl.constexpr, | |
| B: tl.constexpr, | |
| ): | |
| i_n = tl.program_id(0) | |
| o_d = tl.arange(0, B) | |
| m_d = o_d < D | |
| b_p = tl.load(p + i_n * D + o_d, mask=m_d, other=0.) | |
| b_dp = tl.load(dp + i_n * D + o_d, mask=m_d, other=0.) | |
| b_pp = tl.sum(b_p * b_dp, 0) | |
| b_ds = b_p * b_dp - b_p * b_pp | |
| tl.store(ds + i_n * D + o_d, b_ds.to(ds.dtype.element_ty), mask=m_d) | |
| def softmax_fwd( | |
| x: torch.Tensor, | |
| dtype: torch.dtype | None = torch.float, | |
| ) -> torch.Tensor: | |
| shape = x.shape | |
| x = x.view(-1, x.shape[-1]) | |
| N, D = x.shape | |
| B = triton.next_power_of_2(D) | |
| p = torch.empty_like(x, dtype=dtype) | |
| softmax_fwd_kernel[(N,)]( | |
| x=x, | |
| p=p, | |
| D=D, | |
| B=B, | |
| ) | |
| return p.view(*shape) | |
| def softmax_bwd( | |
| p: torch.Tensor, | |
| dp: torch.Tensor, | |
| dtype: torch.dtype | None = torch.float, | |
| ) -> torch.Tensor: | |
| shape = p.shape | |
| p = p.view(-1, p.shape[-1]) | |
| ds = torch.empty_like(p, dtype=dtype) | |
| N, D = p.shape | |
| B = triton.next_power_of_2(D) | |
| softmax_bwd_kernel[(N,)]( | |
| p=p, | |
| dp=dp, | |
| ds=ds, | |
| D=D, | |
| B=B, | |
| ) | |
| return ds.view(*shape) | |