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 import prepare_chunk_indices | |
| def parallel_path_fwd_kernel_prepare_k_cache( | |
| k, k_new, w1, w2, | |
| offsets, indices, | |
| T, | |
| H: tl.constexpr, | |
| K: tl.constexpr, | |
| BT: tl.constexpr, BK: 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(indices + i_t * 2).to(tl.int32), tl.load(indices + i_t * 2 + 1).to(tl.int32) | |
| bos, eos = tl.load(offsets + i_n).to(tl.int32), tl.load(offsets + i_n + 1).to(tl.int32) | |
| T = eos - bos | |
| else: | |
| i_n = i_b | |
| bos, eos = i_n * T, i_n * T + T | |
| k += (bos * H + i_h) * K | |
| k_new += (bos * H + i_h) * K | |
| w1 += (bos * H + i_h) * K | |
| w2 += (bos * H + i_h) * K | |
| # constants | |
| p_k = tl.make_block_ptr(k, (T, K), (H*K, 1), (i_t * BT, 0), (BT, BK), (1, 0)) | |
| b_k = tl.zeros([BT, BK], dtype=tl.float32) | |
| b_k += tl.load(p_k, boundary_check=(0, 1)) | |
| for k_block_idx in range(i_t + 1, tl.cdiv(T, BT)): | |
| p_w1 = tl.make_block_ptr(w1, (T, K), (H*K, 1), (k_block_idx * BT, 0), (BT, BK), (1, 0)) | |
| p_w2 = tl.make_block_ptr(w2, (T, K), (H*K, 1), (k_block_idx * BT, 0), (BT, BK), (1, 0)) | |
| b_w1 = tl.load(p_w1, boundary_check=(0, 1)) | |
| b_w2 = tl.load(p_w2, boundary_check=(0, 1)) | |
| b_A = tl.dot(b_k.to(b_w2.dtype), tl.trans(b_w2)) | |
| b_k = b_k - tl.dot(b_A.to(b_w1.dtype), b_w1) | |
| p_k_new = tl.make_block_ptr(k_new, (T, K), (H*K, 1), (i_t * BT, 0), (BT, BK), (1, 0)) | |
| tl.store(p_k_new, b_k.to(p_k_new.dtype.element_ty), boundary_check=(0, 1)) | |
| def prepare_k_cache_fn(k, w1, w2, cu_seqlens, BS, use_cache=False, chunk_indices: torch.LongTensor | None = None): | |
| if not use_cache: | |
| return None | |
| else: | |
| B, T, H, K = k.shape | |
| k_new = torch.empty_like(k) | |
| if chunk_indices is None and cu_seqlens is not None: | |
| chunk_indices = prepare_chunk_indices(cu_seqlens, BS) | |
| indices = chunk_indices | |
| NT = triton.cdiv(T, BS) if cu_seqlens is None else len(indices) | |
| grid = (NT, B * H) | |
| parallel_path_fwd_kernel_prepare_k_cache[grid]( | |
| k=k, | |
| k_new=k_new, | |
| w1=w1, | |
| w2=w2, | |
| offsets=cu_seqlens, | |
| indices=indices, | |
| H=H, | |
| T=T, | |
| K=K, | |
| BT=BS, | |
| BK=triton.next_power_of_2(K), | |
| ) | |
| return k_new | |