準備您的 model template
概觀
model template 是讓您的模型能夠部署在 ARX 上的關鍵。它是一組 YAML 目錄,宣告模型是什麼、權重從哪裡下載、運行需要多少資源,以及哪些推論引擎能夠服務它。
model template 一律是一組 collection(模型系列),即使只有一個 variant 也一樣。collection 是 marketplace 上的項目,每個 variant 則是同一系列中可獨立部署的建置。
本文說明該目錄的結構,並以宣告模型本身的 model 區塊為重點。
您將學到
- 規劃 collection 與 variant 目錄,並取用彼此一致的 id
- 在
model區塊宣告模型資訊:參數量、格式、精度、任務類型與輸入輸出 - 以
sources指向權重,並以deployment.engines指定服務它的引擎
適用版本
- ARX OS 1.0 以上
開始之前
- 您的模型已發布在 ARX 能下載的位置——Hugging Face 或 ModelScope repository,或其他您能指名的來源
- 若模型是 GGUF 建置,您已掌握要下載的精確檔名
.claude/skills/。目錄結構
template 直接放在 templates/ 底下。collection 的目錄名稱即為它的 id,每個 variant 各有自己的子目錄:
templates/
- publisher.yaml
- models.your-model/
- collection.yaml # collection 的根檔案
- icon.svg # 選用
- localization.yaml # collection 層級的翻譯(選用)
- 0.6b-gguf/ # 每個 variant 一個目錄
- manifest.yaml
- localization.yaml # 選用
- 8b-instruct/
- manifest.yaml
variant 目錄請以尺寸與建置方式命名——0.6b-gguf、4b、8b-instruct、270m——因為這個名稱會成為 variant id 的 @variant 後綴。
以下三個值敘述的是同一個系列,彼此不一致時驗證會失敗:
# collection.yaml
id: models.your-model
# 0.6b-gguf/manifest.yaml
id: models.your-model@0.6b-gguf # '@' 左側即 collection id
model:
collection: your-model # id 的最後一段,不帶前綴
version 常數:collection.yaml 用 version: "1",variant manifest 用 version: "1.0"。在 collection 裡寫成 "1.0" 是整個格式中最常見的第一個錯誤。collection.yaml 的內容
collection 是這個模型系列在 marketplace 上的項目。除 icon 外,以下欄位皆為必填。
| 欄位 | 內容 |
|---|---|
metadata.id / name | 系列 id(與目錄同名、不含 @variant)與顯示名稱 |
metadata.description | 這個系列是什麼、擅長什麼——可以是描述文字本身,也可以是 collection.yaml 旁一個檔案的檔名,由該檔案存放內容 |
metadata.categories | 封閉列舉,至少一項:llm、embedding-model、reranker-model、image-model、audio-model、video-model、multimodal |
metadata.tasks / inputTypes / outputTypes | 與 variant 相同的三組封閉列舉,見 model 區塊 |
metadata.tags / license / developer / updateDate | 自由標籤、授權條款、上游開發者名稱與網址,以及項目最後更新日期 |
collection 沒有 subtitle——variant 才有。
variant manifest.yaml 的內容
| 區塊 | 內容 |
|---|---|
metadata | id、名稱、版本、發布日期、type: models、分類、subtitle、開發者、支援語言與標籤。與 app manifest 不同,subtitle 在這裡是必填 |
metadata.model | 模型本身是什麼——本文的重點區塊 |
resources | 該 variant 服務時所需的 CPU、記憶體、儲存空間、GPU 數量與 VRAM |
deployment | type: model,以及能夠服務它的引擎 |
metadata.releaseDate 請填模型真正的發布日期,取自其來源頁面,而非您撰寫 manifest 的當天。metadata.supportedLanguages 指的是模型本身支援的語言,不是這份 template 翻譯成的語言。
model 區塊
其中必填的是 collection、params、format 與 sources。其餘欄位雖為選用,但通常值得宣告——應用程式的依賴條件會依這些欄位篩選,未宣告的 variant 無法被比對到。
model:
collection: your-model # collection 名稱,不帶前綴
params: "0.6b" # ^[0-9]+(\.[0-9]+)?(b|m)$
variant: reranker
quantization: "Q8_0"
format: gguf
tasks:
- text-ranking
inputTypes:
- text
outputTypes:
- score
sources:
- provider: huggingface
modelId: ggml-org/Qwen3-Reranker-0.6B-Q8_0-GGUF
files:
- "qwen3-reranker-0.6b-q8_0.gguf"
params
純參數量:數字、選用的小數點,以及小寫的 b(billion)或 m(million)。"0.6b" 與 "270m" 正確;"8B" 與 "8b-gguf" 錯誤——建置資訊屬於 variant id。若是 MoE 模型,請填總參數量,並在 subtitle 或 tags 中說明 active 參數。
format
封閉列舉,且它決定哪些引擎能服務這個模型:
| 值 | 由誰服務 |
|---|---|
gguf | llama.cpp |
safetensors | vLLM 與其他 Hugging Face Transformers 型態的 runtime |
ct2 | CTranslate2(faster-whisper) |
variant、precision、quantization
variant——base、instruct、instruction-tuned、chat、embedding、reranker或transcriptionprecision——fp32、fp16、bf16、fp8、int8或int4。GGUF 建置請省略(量化方式已經說明了精度),safetensors 與 ct2 則要填寫quantization——自由字串,例如"Q8_0"、"Q4_K_M"、"awq",或null
tasks、inputTypes、outputTypes
三組封閉列舉,與 collection 宣告的相同:
| 類型 | tasks | inputTypes | outputTypes |
|---|---|---|---|
| LLM | text-generation | text | text |
| Embedding | text-embedding | text | vector |
| Reranker | text-ranking | text | score |
| 語音轉文字 | audio-to-text | audio | text |
sources
依優先順序排列的下載來源。每一項需要 provider(huggingface、modelscope、ollama 或 custom)與 modelId。加上 files 可將下載範圍縮限到特定檔案,由 llama.cpp 服務的 GGUF 建置一定要這樣寫。
檔名必須與來源方的檔案清單完全一致,請實際查閱而不要憑印象填寫。另請注意,這裡的 ollama 是下載來源,不是推論引擎。
deployment.engines
至少一個引擎,每一項都要有 name 與此模型在該引擎上服務的 apiEndpoints:
deployment:
type: model
engines:
- name: llama.cpp
version: ">=0.11.0" # 選用
apiEndpoints:
- /v1/chat/completions
contextWindow: 32768
引擎名稱必須能對應到驗證器內建的推論引擎目錄:GGUF 用 llamacpp(別名 llama.cpp、llama_cpp),safetensors 用 vllm 與 nvidia-vllm,ct2 語音轉文字用 whisper(別名 faster-whisper)。其他名稱一律驗證失敗。
contextWindow 至少要宣告在第一個引擎上——應用程式的依賴條件比對的就是這個值。
resources
依實際檔案與實測的服務用量估算:storage 是實際下載內容的大小,vram 是權重加上在所宣告 context window 下的 KV cache,並保留餘裕。純 CPU 模型填 gpu: 0 與 vram: null。
選用檔案
icon.svg 是 AI Model Center 列出這個 collection 時使用的圖示——正方形、256×256 以上、透明背景,優先使用 SVG。
localization.yaml 負責翻譯使用者可見的字串,模型會在兩個層級各有一份:一份放在 collection.yaml 旁,一份放在每個 variant 目錄內。模型名稱不翻譯——型號在任何語言中都是同一個寫法。
