Instructions to use OpenFormosa/barbet-1b-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenFormosa/barbet-1b-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OpenFormosa/barbet-1b-base", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("OpenFormosa/barbet-1b-base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenFormosa/barbet-1b-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenFormosa/barbet-1b-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenFormosa/barbet-1b-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/OpenFormosa/barbet-1b-base
- SGLang
How to use OpenFormosa/barbet-1b-base 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 "OpenFormosa/barbet-1b-base" \ --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": "OpenFormosa/barbet-1b-base", "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 "OpenFormosa/barbet-1b-base" \ --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": "OpenFormosa/barbet-1b-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use OpenFormosa/barbet-1b-base with Docker Model Runner:
docker model run hf.co/OpenFormosa/barbet-1b-base
Barbet 1B Base
OpenFormosa/barbet-1b-base 是 Barbet 1B 基礎模型的 Hugging Face 封裝。模型是 decoder-only hybrid causal LM,交錯使用 global attention、8K sliding-window attention 與 Mamba2 block,詞彙表搭配 openformosa/PangolinTokenizer。
本次發布權重來自實驗保留的 Retry29 iteration 128 checkpoint。它取代先前 iteration 96 的 Hub 權重。
模型架構
| 項目 | 設定 |
|---|---|
| Parameters | 1,088,124,920 |
| Hidden size | 1,536 |
| Logical layers | 28 |
| Global-attention layers | 7 |
| Sliding-window attention layers | 14 |
| Mamba2 layers | 7 |
| Attention heads / KV heads | 16 / 2 |
| Sliding window | 8,192 |
| Vocabulary size | 114,944 |
| Weight dtype | BF16 |
上下文能力與限制
config.json 的 max_position_embeddings=262144 表示 256K 執行路徑,不代表模型已能穩定理解或使用全部 256K tokens。保守的本次發布 claim 是:exact synthetic NIAH 在 32K 穩定通過。
| 評估 | 結果 | 發布判讀 |
|---|---|---|
| Canonical exact NIAH, 32K | 32/32 | 通過 |
| Canonical exact NIAH, 64K | 28/32 | 未達穩定 gate |
| Canonical exact NIAH, 128K | 25/32 | 未達穩定 gate |
| Canonical exact NIAH, 256K | 20-23/32 | 未達穩定 gate |
| Retry29 easy standard NIAH, native 256K | 32/32 | 機制診斷,不作 capability claim |
| Retry29 easy opaque NIAH, native 256K | 32/32 | 機制診斷,不作 capability claim |
| Book-grounded native 256K smoke | 5/8 | 未通過 |
| Clean 320-book evaluation | 172/960 (17.92%) | 未通過 |
Exact NIAH 只測量字面定位,不代表 semantic retrieval、證據利用、multi-hop reasoning 或完整長文本理解。研究中的 external/hierarchical verifier 權重也不包含在此 base checkpoint 中。
config_1m_extension.json 提供線性 RoPE scaling factor 4 的研究設定。它只是 experimental 1M runtime configuration,不是原生 1M 訓練,也不是穩定 1M capability claim。
載入方式
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("openformosa/PangolinTokenizer")
model = AutoModelForCausalLM.from_pretrained(
"OpenFormosa/barbet-1b-base",
trust_remote_code=True,
torch_dtype=torch.bfloat16,
device_map="auto",
)
Hub 的 config.json 與 config_256k.json 是 256K runtime 設定;config_1m_extension.json 是同一權重的實驗性 1M 外推設定。長序列仍需要相容且經最佳化的執行環境。
CUDA 環境建議安裝相容版本的 mamba_ssm。缺少 mamba_ssm 時,custom model code 會使用較慢的 PyTorch fallback;不同 kernel 與數值精度可能帶來小幅 logits 差異。
發布與轉換
- Source checkpoint:
retry29_early_pair_retained/r29_earlypair_r0w40v2_srcj150994_i320_j151842_i128 - Source iteration:
128 - Export format: single BF16
model.safetensors - Tied LM head:
lm_head.weight與 token embedding 共用,未重複儲存 - Optimizer、RNG state、raw distributed shards 與 MTP auxiliary tensors未上傳
- Conversion details and hashes:
conversion_report.jsonandrelease_manifest.json
適用範圍
Barbet 1B Base 適合正體中文與多語 causal language modeling、長上下文機制分析及後續微調研究。它不是 instruction-tuned assistant,也未完成面向使用者部署所需的 safety alignment。
已知限制
- 穩定長度 claim 目前是 32K exact synthetic NIAH,不是 256K 或 1M semantic understanding。
- Book-grounded 256K retrieval 與 evidence utilization 尚未通過 release gate。
- 模型可能生成錯誤、重複、有偏差或不安全內容;高風險用途需要獨立驗證與防護。
- License metadata 沿用
other;使用前請確認適用條款與資料授權。
- Downloads last month
- 1,676