Логотип 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, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний 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. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/intel/skills/tree/main/skills/xpu-model-type-detect
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Нова навичка → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
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, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі

Створіть власний ШІ-простір уже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇