Логотип Xpu Model Type Detect

Xpu Model Type Detect

Организация
intel
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.

Обзор

Издательintel
Репозиторийskills
Название навыкаxpu-model-type-detect
Звёзды
31
Форки
14
Встроенные файлы
1
ЛицензияApache-2.0
Ссылки
  • Инструкции в формате Markdown

    Файл SKILL.md, который модель загружает по необходимости, поэтому токены расходуются только при подходящем запросе.

  • Работает с любой языковой моделью

    Навыки ИИ — это обычный Markdown, а не код для конкретного поставщика, поэтому они работают с GPT, Claude, Gemini, Grok и локальными моделями.

  • Файлы в комплекте: 1

    Скрипты, шаблоны и справочные материалы, которые модель может читать во время работы. Файлы доступны только для чтения и никогда не выполняются.

  • Открытый исходный код

    Опубликовано на GitHub: intel. Перед установкой изучите исходные материалы.

Установка

Установите навык ИИ Xpu Model Type Detect в TypingMind, чтобы использовать его с любой LLM, или добавьте его в другой агент, который умеет читать SKILL.md.

1

Установка в TypingMind

TypingMind устанавливает навык прямо из его папки на GitHub: читает SKILL.md, собирает файлы ресурсов и сохраняет результат локально.

  1. Откройте приложение и перейдите в раздел «Плагины → Навыки».
  2. Выберите «Установить из GitHub».
  3. Вставьте указанную ниже ссылку на папку навыка и подтвердите установку.
    https://github.com/intel/skills/tree/main/skills/xpu-model-type-detect
  4. Включите навык в каждом чате, где хотите его использовать.
Плагины → Навыки → Новый навык → По ссылке GitHub, затем вставьте ссылку на папку и нажмите «Продолжить».
2

Установка в другом агенте

Любой агент с поддержкой формата Agent Skills может использовать этот навык — скопируйте папку в каталог навыков этого агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/intel/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/xpu-model-type-detect .claude/skills/xpu-model-type-detect
После копирования перезапустите Claude Code, чтобы загрузить новый навык.

Использование в TypingMind

Включите навык Xpu Model Type Detect в любом чате TypingMind, и дальше модель всё сделает сама. Его название и описание хранятся в системном промпте, а при появлении подходящего запроса модель сама загружает полные инструкции. Вам не нужно вызывать навык вручную, и до фактического использования он не расходует токены.

Модель сама загружает навык Xpu Model Type Detect, как только появляется подходящий для него запрос.

Работает с любой моделью ИИ

Навыки ИИ — это обычные инструкции в Markdown, а не код для конкретного поставщика, поэтому навык Xpu Model Type Detect не привязан к модели, для которой он был создан. Установите его один раз в TypingMind и используйте с GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama или локальной моделью, которую запускаете самостоятельно, — со своими API-ключами.

  • Загружается только при необходимости

    Системный промпт содержит только название и описание. Инструкции загружаются при первом подходящем запросе, поэтому неиспользуемый навык не расходует токены.

  • Меняйте модели прямо в чате

    Навык состоит из инструкций, а не кода, поэтому смена модели не нарушает его работу: новая модель читает тот же файл SKILL.md.

Инструкции навыка

Это содержимое файла SKILL.md, которое загружает модель. Прочитайте его перед установкой: навык — это инструкции, которым будет следовать ваша модель.

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

sh
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.

  1. 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*).
  2. config.architectures[0] — authoritative when present. Pulled directly from config.json on the Hub (no weight download). This is where most non-name-matched models classify.
  3. 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 typeLoader classInput kwargsTypical hit signal
text_generationAutoModelForCausalLMinput_ids, attention_mask*CausalLM, *LMHeadModel (decoder-only LLM architectures)
seq2seqAutoModelForSeq2SeqLMinput_ids, decoder_input_ids*Seq2SeqLM, *ForConditionalGeneration (T5, BART, MBart)
masked_lmAutoModelForMaskedLMinput_ids*ForMaskedLM
text_encoderAutoModel + mean-pool last_hidden_stateinput_ids, attention_maskBertModel, RobertaModel, DebertaModel, XLMRobertaModel, name *-embed*, *-bge*
vision_language (CLIP family)CLIPModel / SigLIPModel + AutoProcessorpixel_values, input_idsCLIPModel, SiglipModel, both vision and text towers
vision_classificationAutoModelForImageClassification + AutoImageProcessorpixel_values*ForImageClassification, ViTModel, Swin*, ConvNext*
audio_encoderAutoModel + AutoFeatureExtractorinput_valuesWav2Vec2Model, HubertModel, WavLMModel
audio_seq2seqAutoModelForSpeechSeq2Seqinput_features, decoder_input_idsWhisperForConditionalGeneration
multimodal_vlAutoModelForVision2Seq + AutoProcessorpixel_values, input_idsLlavaForConditionalGeneration, Qwen2VLForConditionalGeneration, Gemma3ForConditionalGeneration
reward_modelfast-fail; no smoke testn/a*ForScore, name *-rm, *-reward
diffusionDiffusionPipeline (diffusers)promptmodel_index.json at repo root
time_seriesAutoModelpast_values, past_time_featuresChronos, PatchTST, *ForTimeSeriesForecasting

Gotchas

  • Sentence-Transformers repos often have architectures[0] = BertModel but the intended usage is AutoModel + mean pooling — not AutoModelForSequenceClassification. The detector catches this via the canonical modules.json marker file (every ST repo has it; config_sentence_transformers.json is checked as a secondary marker) and returns text_encoder.
  • CLIP variants with only vision_model (e.g. pure ViT CLIP vision-encoder releases) classify as vision_classification, not vision_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_ids at all — don't try to tokenise text for them.
  • Diffusion repos have no top-level config.json; the detector looks for model_index.json. Route these to torch-xpu-bench for 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:

  1. Open the model card (README.md in the HF repo); read the first usage snippet.
  2. If the snippet imports a class not in the table above, search Transformers docs for that class's AutoModel* equivalent.

End-to-end flow (beginner-friendly)

Given Qwen/Qwen2.5-7B-Instruct:

sh
python3 scripts/detect.py --model Qwen/Qwen2.5-7B-Instruct --json
# {"detected": "text_generation", "loader": "transformers.AutoModelForCausalLM",
#  "inputs": ["input_ids", "attention_mask"], ...}

The agent then uses torch-xpu-run's preflight helper with the correct loader class and the correct first generate() call.

Given openai/clip-vit-base-patch32:

sh
python3 scripts/detect.py --model openai/clip-vit-base-patch32
# detected: vision_language  ->  CLIPModel + AutoProcessor + pixel_values + input_ids

The agent supplies an image alongside the prompt instead of calling model.generate(input_ids=...).

Output schema (with --json)

json
{
  "model_id": "openai/clip-vit-base-patch32",
  "detected": "vision_language",
  "loader": "transformers.CLIPModel",
  "processor": "transformers.AutoProcessor",
  "inputs": ["pixel_values", "input_ids"],
  "confidence": "architectures[0]",
  "rationale": "architectures[0]=CLIPModel; text + vision towers detected",
  "signals": {
    "name_pattern": null,
    "config_architectures": ["CLIPModel"],
    "pipeline_tag": "zero-shot-image-classification"
  }
}

Exit codes

CodeMeaning
0Detection succeeded; detected is a usable type
2unknown or incompatible — detection could not resolve a loader; read detected + rationale to distinguish
3reward_model — detection succeeded but the model is not suitable for conversational smoke tests

Codes 2 and 3 are expected outcomes, not crashes. Agents should read the detected field rather than treating any non-zero exit as a failure.

What this skill does NOT cover

  • Loading the model (see torch-xpu-run / vllm-xpu-run).
  • VRAM sizing (see model-can-it-fit).

References

Встроенные файлы

Модель читает эти файлы по мере необходимости, пока навык загружен. Они доступны только для чтения и никогда не выполняются.

Часто задаваемые вопросы

Что делает навык ИИ 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 в TypingMind?

Потому что вы устанавливаете навык один раз и используете его с любой моделью. Xpu Model Type Detect — это обычный текст в формате Markdown, а не код для конкретного поставщика, поэтому один и тот же навык работает с GPT-5, Claude, Gemini, Grok или локальной моделью. Вы можете менять модель прямо во время чата, и навык продолжит работать. TypingMind использует ваши собственные ключи API, поэтому вы платите поставщикам напрямую, а не оформляете подписку с оплатой за каждое место. Ваши навыки и чаты остаются в вашем собственном хранилище.

Как установить Xpu Model Type Detect в TypingMind?

В TypingMind откройте «Плагины → Навыки → Установить из GitHub» и вставьте https://github.com/intel/skills/tree/main/skills/xpu-model-type-detect. TypingMind прочитает файл SKILL.md, включит сопутствующие файлы в пакет и установит навык, который можно включать отдельно для каждого чата.

Какие модели ИИ могут использовать Xpu Model Type Detect?

Любая модель, которую вы подключите в TypingMind. Навыки ИИ — это обычные инструкции в формате Markdown, а не код для конкретного поставщика, поэтому GPT, Claude, Gemini, Grok и локальные модели могут загружать этот навык, когда запрос ему соответствует.

Со сколькими моделями ИИ можно использовать Xpu Model Type Detect?

С любым количеством. Если модель поддерживает навыки, вы можете использовать с ней Xpu Model Type Detect: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama и другие — всё в TypingMind с вашими собственными ключами API.

Бесплатен ли навык ИИ Xpu Model Type Detect?

Да. Навык опубликован на GitHub автором intel по лицензии Apache-2.0. Вы платите только своему поставщику ИИ за использованные токены.

Что такое навыки ИИ?

Навык ИИ — это многоразовый набор инструкций, который объясняет модели ИИ, как выполнять конкретную задачу. Он соответствует открытому формату Agent Skills: файл SKILL.md с названием и описанием, а также любые скрипты, шаблоны или справочные файлы, которые могут понадобиться модели. Модель читает инструкции, только когда ваш запрос соответствует навыку, поэтому установленный навык ничего не стоит, пока не используется.

Чем навыки ИИ отличаются от плагинов и серверов MCP?

Плагин или сервер MCP даёт модели новые инструменты для вызова — код, который где-то выполняется и возвращает результат. Навык ИИ вместо этого даёт модели знания и порядок действий: как подойти к задаче, какие шаги выполнить и каким должен быть хороший результат. Навыки — это обычный текст в формате Markdown, поэтому им не нужны сервер, ключ API или среда выполнения, и они работают с любой моделью.

Все

Создайте свою рабочую ИИ-среду сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇