Text Generation
Transformers
Safetensors
Chinese
English
samai_27b
pondernet
mixture-of-experts
adaptive-computation
multi-token-prediction
qwen3.8
conversational
custom_code
Instructions to use tchbcb/samai-27b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tchbcb/samai-27b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tchbcb/samai-27b", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("tchbcb/samai-27b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tchbcb/samai-27b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tchbcb/samai-27b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tchbcb/samai-27b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tchbcb/samai-27b
- SGLang
How to use tchbcb/samai-27b 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 "tchbcb/samai-27b" \ --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": "tchbcb/samai-27b", "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 "tchbcb/samai-27b" \ --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": "tchbcb/samai-27b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tchbcb/samai-27b with Docker Model Runner:
docker model run hf.co/tchbcb/samai-27b
backup s27b_tunnel.sh
Browse files- sft-adapter/s27b_tunnel.sh +77 -0
sft-adapter/s27b_tunnel.sh
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# ============================================================================
|
| 3 |
+
# s27b_tunnel.sh — 为 samai-27b-mixbit API 开 aitun.cc 公网隧道
|
| 4 |
+
# 移植自 s4b_tunnel.sh; 独立 HOME, 不影响 kagglemcp 网关隧道 (port 5000)
|
| 5 |
+
#
|
| 6 |
+
# 用法:
|
| 7 |
+
# bash s27b_tunnel.sh start | stop | status
|
| 8 |
+
# PORT=8100 bash s27b_tunnel.sh start
|
| 9 |
+
# ============================================================================
|
| 10 |
+
set -euo pipefail
|
| 11 |
+
|
| 12 |
+
PORT="${PORT:-8100}"
|
| 13 |
+
LOG_FILE="/tmp/k27/s27b-aitun-tunnel.log"
|
| 14 |
+
PID_FILE="/tmp/k27/s27b-aitun-tunnel.pid"
|
| 15 |
+
|
| 16 |
+
CLIENT_BIN="$(ls /usr/local/lib/python3.*/dist-packages/aitun/bin/aitun-client-linux-amd64 2>/dev/null | head -1 || true)"
|
| 17 |
+
[[ -z "$CLIENT_BIN" ]] && CLIENT_BIN="$(ls /usr/local/lib/python3.*/site-packages/aitun/bin/aitun-client-linux-amd64 2>/dev/null | head -1 || true)"
|
| 18 |
+
API_HOME="/root/.aitun-samai27b"
|
| 19 |
+
|
| 20 |
+
GREEN='\033[0;32m'; RED='\033[0;31m'; CYAN='\033[0;36m'; NC='\033[0m'
|
| 21 |
+
info() { echo -e "${GREEN}[隧道]${NC} $*"; }
|
| 22 |
+
fail() { echo -e "${RED}[隧道]${NC} $*"; exit 1; }
|
| 23 |
+
|
| 24 |
+
[[ -n "$CLIENT_BIN" && -x "$CLIENT_BIN" ]] || fail "未找到 aitun 客户端 (pip install aitun)"
|
| 25 |
+
|
| 26 |
+
extract_url() { grep -oE "https://aitun\.cc/[A-Za-z0-9]+" "$LOG_FILE" 2>/dev/null | tail -1; }
|
| 27 |
+
|
| 28 |
+
do_stop() {
|
| 29 |
+
if [[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
|
| 30 |
+
kill "$(cat "$PID_FILE")" && info "隧道已停止 (PID $(cat "$PID_FILE"))"
|
| 31 |
+
fi
|
| 32 |
+
rm -f "$PID_FILE"
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
do_start() {
|
| 36 |
+
do_stop 2>/dev/null || true
|
| 37 |
+
mkdir -p "$API_HOME"
|
| 38 |
+
info "启动隧道 (本地 :$PORT → 公网)..."
|
| 39 |
+
HOME="$API_HOME" nohup "$CLIENT_BIN" -s aitun.cc:6639 -p "$PORT" \
|
| 40 |
+
> "$LOG_FILE" 2>&1 &
|
| 41 |
+
echo $! > "$PID_FILE"
|
| 42 |
+
for i in $(seq 1 12); do
|
| 43 |
+
sleep 5
|
| 44 |
+
URL="$(extract_url)"
|
| 45 |
+
if [[ -n "$URL" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
|
| 46 |
+
info "隧道已建立!"
|
| 47 |
+
echo -e "${CYAN}──────────────────────────────────────────────────${NC}"
|
| 48 |
+
echo -e " 公网 API: $URL/v1/chat/completions"
|
| 49 |
+
echo -e " 健康检查: $URL/health"
|
| 50 |
+
echo -e " 模型列表: $URL/v1/models"
|
| 51 |
+
echo -e " API Key: 1234 (Authorization: Bearer 1234)"
|
| 52 |
+
echo -e "${CYAN}──────────────────────────────────────────────────${NC}"
|
| 53 |
+
echo -e " curl 示例:"
|
| 54 |
+
echo -e " curl -N $URL/v1/chat/completions \\"
|
| 55 |
+
echo -e " -H 'Content-Type: application/json' -H 'Authorization: Bearer 1234' \\"
|
| 56 |
+
echo -e " -d '{\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}],\"stream\":true}'"
|
| 57 |
+
return 0
|
| 58 |
+
fi
|
| 59 |
+
kill -0 "$(cat "$PID_FILE")" 2>/dev/null || fail "隧道进程退出, 日志: $(tail -10 "$LOG_FILE")"
|
| 60 |
+
done
|
| 61 |
+
fail "60s 未取得公网 URL, 日志: $(tail -15 "$LOG_FILE")"
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
do_status() {
|
| 65 |
+
if [[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
|
| 66 |
+
info "隧道运行中 (PID $(cat "$PID_FILE")) URL: $(extract_url)"
|
| 67 |
+
else
|
| 68 |
+
echo "隧道未运行"
|
| 69 |
+
fi
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
case "${1:-help}" in
|
| 73 |
+
start) do_start ;;
|
| 74 |
+
stop) do_stop ;;
|
| 75 |
+
status) do_status ;;
|
| 76 |
+
*) grep '^# ' "$0" | sed 's/^# //' ;;
|
| 77 |
+
esac
|