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
| import torch | |
| import triton | |
| import triton.language as tl | |
| from fla.ops.utils.index import prepare_chunk_indices | |
| from fla.utils import autotune_cache_kwargs | |
| def chunk_comba_cumsum_scalar_fwd_kernel( | |
| g, | |
| g0, | |
| g1, | |
| scale, | |
| cu_seqlens, | |
| chunk_indices, | |
| T, | |
| B: tl.constexpr, | |
| H: tl.constexpr, | |
| BT: tl.constexpr, | |
| HAS_SCALE: tl.constexpr, | |
| IS_VARLEN: tl.constexpr, | |
| ): | |
| i_t, i_bh = tl.program_id(0), tl.program_id(1) | |
| i_b, i_h = i_bh // H, i_bh % H | |
| if IS_VARLEN: | |
| i_n, i_t = tl.load(chunk_indices + i_t * 2).to(tl.int32), tl.load(chunk_indices + i_t * 2 + 1).to(tl.int32) | |
| bos, eos = tl.load(cu_seqlens + i_n).to(tl.int32), tl.load(cu_seqlens + i_n + 1).to(tl.int32) | |
| T = eos - bos | |
| else: | |
| bos, eos = i_b * T, i_b * T + T | |
| p_g = tl.make_block_ptr(g + bos*H + i_h, (T,), (H,), (i_t * BT,), (BT,), (0,)) | |
| p_g0 = tl.make_block_ptr(g0 + bos*H + i_h, (T,), (H,), (i_t * BT,), (BT,), (0,)) | |
| p_g1 = tl.make_block_ptr(g1 + bos*H + i_h, (T,), (H,), (i_t * BT,), (BT,), (0,)) | |
| # [BT] | |
| b_g = tl.load(p_g, boundary_check=(0,)).to(tl.float32) | |
| if HAS_SCALE: | |
| b_g = b_g * scale | |
| b_g1 = tl.cumsum(b_g, axis=0) | |
| b_g0 = b_g1 - b_g | |
| tl.store(p_g0, b_g0.to(p_g0.dtype.element_ty), boundary_check=(0,)) | |
| tl.store(p_g1, b_g1.to(p_g1.dtype.element_ty), boundary_check=(0,)) | |
| def chunk_comba_cumsum_scalar_fwd( | |
| g: torch.Tensor, | |
| chunk_size: int, | |
| cu_seqlens: torch.Tensor | None = None, | |
| output_dtype: torch.dtype | None = torch.float, | |
| chunk_indices: torch.LongTensor | None = None, | |
| scale: float | None = None, | |
| ) -> torch.Tensor: | |
| B, T, H = g.shape | |
| assert chunk_size == 2**(chunk_size.bit_length()-1), "chunk_size must be a power of 2" | |
| BT = chunk_size | |
| if chunk_indices is None and cu_seqlens is not None: | |
| chunk_indices = prepare_chunk_indices(cu_seqlens, BT) | |
| NT = triton.cdiv(T, BT) if cu_seqlens is None else len(chunk_indices) | |
| g0, g1 = torch.empty_like(g, dtype=output_dtype or g.dtype), torch.empty_like(g, dtype=output_dtype or g.dtype) | |
| grid = (NT, B * H) | |
| chunk_comba_cumsum_scalar_fwd_kernel[grid]( | |
| g, | |
| g0, | |
| g1, | |
| scale, | |
| cu_seqlens, | |
| chunk_indices, | |
| T=T, | |
| B=B, | |
| H=H, | |
| BT=BT, | |
| ) | |
| return g0, g1 | |
| def chunk_comba_cumsum_scalar_bwd_kernel( | |
| dg0, | |
| dgr, | |
| cu_seqlens, | |
| chunk_indices, | |
| T, | |
| B: tl.constexpr, | |
| H: tl.constexpr, | |
| BT: tl.constexpr, | |
| IS_VARLEN: tl.constexpr, | |
| ): | |
| i_t, i_bh = tl.program_id(0), tl.program_id(1) | |
| i_b, i_h = i_bh // H, i_bh % H | |
| if IS_VARLEN: | |
| i_n, i_t = tl.load(chunk_indices + i_t * 2).to(tl.int32), tl.load(chunk_indices + i_t * 2 + 1).to(tl.int32) | |
| bos, eos = tl.load(cu_seqlens + i_n).to(tl.int32), tl.load(cu_seqlens + i_n + 1).to(tl.int32) | |
| T = eos - bos | |
| else: | |
| bos, eos = i_b * T, i_b * T + T | |
| p_dg0 = tl.make_block_ptr(dg0 + bos*H + i_h, (T,), (H,), (i_t * BT,), (BT,), (0,)) | |
| p_dgr = tl.make_block_ptr(dgr + bos*H + i_h, (T,), (H,), (i_t * BT,), (BT,), (0,)) | |
| # [BT] | |
| """ | |
| b_dg: 1,2,3,4 | |
| b_dg0: 0,1,2,3 | |
| b_temp: 0,1,3,6 | |
| b_dz: 6 | |
| b_dgr: 6,5,3,0 | |
| """ | |
| b_dg0 = tl.load(p_dg0, boundary_check=(0,)).to(tl.float32) | |
| b_temp = tl.cumsum(b_dg0, axis=0) | |
| b_dz = tl.sum(b_dg0, axis=0) | |
| b_dgr = -b_temp + b_dz[None] | |
| tl.store(p_dgr, b_dgr.to(p_dgr.dtype.element_ty), boundary_check=(0,)) | |
| def chunk_comba_cumsum_scalar_bwd( | |
| dg0: torch.Tensor, | |
| chunk_size: int, | |
| cu_seqlens: torch.Tensor | None = None, | |
| output_dtype: torch.dtype | None = torch.float, | |
| chunk_indices: torch.LongTensor | None = None, | |
| ) -> torch.Tensor: | |
| B, T, H = dg0.shape | |
| assert chunk_size == 2**(chunk_size.bit_length()-1), "chunk_size must be a power of 2" | |
| BT = chunk_size | |
| if chunk_indices is None and cu_seqlens is not None: | |
| chunk_indices = prepare_chunk_indices(cu_seqlens, BT) | |
| NT = triton.cdiv(T, BT) if cu_seqlens is None else len(chunk_indices) | |
| dg = torch.empty_like(dg0, dtype=output_dtype or dg0.dtype) | |
| grid = (NT, B * H) | |
| chunk_comba_cumsum_scalar_bwd_kernel[grid]( | |
| dg0, | |
| dg, | |
| cu_seqlens, | |
| chunk_indices, | |
| T=T, | |
| B=B, | |
| H=H, | |
| BT=BT, | |
| ) | |
| return dg | |