Logo Xpu Model Type Detect

Xpu Model Type Detect

Tổ chức
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.

Tổng quan

Nhà phát hànhintel
Kho mãskills
Tên kỹ năngxpu-model-type-detect
Sao
31
Bản fork
14
Tệp đi kèm
1
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 1 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được intel công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Xpu Model Type Detect trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/intel/skills/tree/main/skills/xpu-model-type-detect
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

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
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Xpu Model Type Detect trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Xpu Model Type Detect ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Xpu Model Type Detect không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

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

Tệp đi kèm

Mô hình đọc các tệp này khi cần trong lúc kỹ năng được tải. Các tệp được cung cấp ở dạng có thể đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Xpu Model Type Detect làm được gì?

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.

Vì sao nên dùng Xpu Model Type Detect trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Xpu Model Type Detect là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Xpu Model Type Detect trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/intel/skills/tree/main/skills/xpu-model-type-detect. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Xpu Model Type Detect?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Xpu Model Type Detect với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Xpu Model Type Detect với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Xpu Model Type Detect có miễn phí không?

Có. Kỹ năng này được intel phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇