xpu-model-type-detect
Before loading a Hugging Face model on Intel XPU, detect its actual type (text generation, text encoder, seq2seq, vision classification, vision-language…
от intel★ 54 звезды на GitHub
Установить xpu-model-type-detect в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
xpu-model-type-detect
Pick the right loader class before you load. A wrong loader class produces an opaque failure after the model is already on XPU — 20+ seconds into a load you didn't need to make.
Reporting the verdict
Run scripts/detect.py against the model id rather than answering
its type from memory — even for a familiar model, the detector's
verdict is the citable result. Then paste its output block verbatim
in a fenced code block, keeping the detected:, loader:, inputs:,
and confidence: lines as-is rather than reformatting them into a
table — those literal labels are what the user and downstream tools
key on. Lead with the confirmed type, e.g. "detection confirmed:
multimodal_vl", to show the verdict came from the run.
Detection is read-only, so there's nothing to health-check afterward — confirming the verdict block is the result.
Quickstart
python3 scripts/detect.py --model openai/clip-vit-base-patch32
model_id: openai/clip-vit-base-patch32
detected: vision_language
loader: transformers.CLIPModel
processor: transformers.AutoProcessor
inputs: pixel_values, input_ids
rationale: architectures[0]=CLIPModel; text + vision towers detected
Stdlib only. HF_TOKEN needed for gated repos.
With --json the output is a single JSON object suitable for piping
into another tool.
3-stage detection
The script tries three signals in order; first hit wins.
- Name pattern on
model_id— cheapest. Currently catches reward models (*-rm,*-reward), embedding repos (*-embed*,bge-,gte-,e5-,jina-embed*), and incompatible checkpoints (*-mlx*,*-gguf*). config.architectures[0]— authoritative when present. Pulled directly fromconfig.jsonon the Hub (no weight download). This is where most non-name-matched models classify.- HF Hub
pipeline_tag— last resort; one HTTP call to/api/models/<id>.
If all three miss, the script prints unknown and suggests reading the
model card's first usage snippet.
Types and their loaders
| Detected type | Loader class | Input kwargs | Typical hit signal |
|---|---|---|---|
text_generation |
AutoModelForCausalLM |
input_ids, attention_mask |
*CausalLM, *LMHeadModel (decoder-only LLM architectures) |
seq2seq |
AutoModelForSeq2SeqLM |
input_ids, decoder_input_ids |
*Seq2SeqLM, *ForConditionalGeneration (T5, BART, MBart) |
masked_lm |
AutoModelForMaskedLM |
input_ids |
*ForMaskedLM |
text_encoder |
AutoModel + mean-pool last_hidden_state |
input_ids, attention_mask |
BertModel, RobertaModel, DebertaModel, XLMRobertaModel, name *-embed*, *-bge* |
vision_language (CLIP family) |
CLIPModel / SigLIPModel + AutoProcessor |
pixel_values, input_ids |
CLIPModel, SiglipModel, both vision and text towers |
vision_classification |
AutoModelForImageClassification + AutoImageProcessor |
pixel_values |
*ForImageClassification, ViTModel, Swin*, ConvNext* |
audio_encoder |
AutoModel + AutoFeatureExtractor |
input_values |
Wav2Vec2Model, HubertModel, WavLMModel |
audio_seq2seq |
AutoModelForSpeechSeq2Seq |
input_features, decoder_input_ids |
WhisperForConditionalGeneration |
multimodal_vl |
AutoModelForVision2Seq + AutoProcessor |
pixel_values, input_ids |
LlavaForConditionalGeneration, Qwen2VLForConditionalGeneration, Gemma3ForConditionalGeneration |
reward_model |
fast-fail; no smoke test | n/a | *ForScore, name *-rm, *-reward |
diffusion |
DiffusionPipeline (diffusers) |
prompt |
model_index.json at repo root |
time_series |
AutoModel |
past_values, past_time_features |
Chronos, PatchTST, *ForTimeSeriesForecasting |
Gotchas
- Sentence-Transformers repos often have
architectures[0] = BertModelbut the intended usage isAutoModel+ mean pooling — notAutoModelForSequenceClassification. The detector catches this via the canonicalmodules.jsonmarker file (every ST repo has it;config_sentence_transformers.jsonis checked as a secondary marker) and returnstext_encoder. - CLIP variants with only
vision_model(e.g. pure ViT CLIP vision-encoder releases) classify asvision_classification, notvision_language. - Reward models look like classifiers but the output is a scalar score, not class logits. Agents should skip smoke tests and tell the user reward models aren't meant for conversational use.
- Time-series models (Chronos, PatchTST) don't take
input_idsat all — don't try to tokenise text for them. - Diffusion repos have no top-level
config.json; the detector looks formodel_index.json. Route these totorch-xpu-benchfor sizing (VRAM depends on resolution × steps × scheduler).
When auto-detect is wrong
The detector is conservative. If it returns unknown, or the user
confirms the suggested loader is wrong:
- Open
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- scripts/detect.py
FAQ
Что делает скилл xpu-model-type-detect?
Before loading a Hugging Face model on Intel XPU, detect its actual type (text generation, text encoder, seq2seq, vision classification, vision-language, audio encoder, audio seq2seq, multimodal VL, diffusion, time-series, reward model, masked LM) so the agent picks the right `AutoModel` class and input kwargs. Prevents "got unexpected keyword argument 'pixel_values'" and "empty logits" errors from mis-routing. Use before `torch-xpu-run` or `vllm-xpu-run` when the user gives a model id the agent hasn't seen before, or when a smoke test fails with a wrong-input signature.
Как установить скилл xpu-model-type-detect?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл xpu-model-type-detect запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…