AGENT SKILL

tensorflow-hub

Use TensorFlow Hub to resolve, load, wrap, and export Hub-compatible TensorFlow SavedModels.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
tensorflow-hub
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use TensorFlow Hub to resolve, load, wrap, and export Hub-compatible TensorFlow SavedModels.
disable-model-invocation
true

02 资源文件 3

03 SKILL.md 正文

TensorFlow Hub

Use this repo skill when a task involves the tensorflow-hub package, the tensorflow_hub import, TensorFlow Hub/Kaggle Models handles, tfhub.dev URLs, local Hub-compatible SavedModel directories, hub.load, hub.resolve, or hub.KerasLayer.

The current package surface verified for this skill exposes only these top-level APIs:

import tensorflow_hub as hub

hub.load
hub.resolve
hub.KerasLayer

Feature-column text embedding support is available through a submodule import, not as a top-level hub attribute:

import tensorflow_hub.feature_column_v2 as hub_feature_column_v2

Quick install and import check

Use a TensorFlow runtime that matches the Python environment. In Keras 3 environments, install the matching tf-keras compatibility package as well.

python -m pip install tensorflow-hub tensorflow tf-keras
python - <<'PY'
import tensorflow as tf
import tensorflow_hub as hub
print("tensorflow", tf.__version__)
print("tensorflow_hub", hub.__version__)
print("exports", hub.__all__)
PY

If the import check fails, read references/troubleshooting.md before changing package versions.

Route map

User task or symptom Read next
Resolve or load a Hub handle, local SavedModel path, tfhub.dev/Kaggle Models URL, or archive sub-skills/load-and-wrap/SKILL.md
Diagnose TFHUB_CACHE_DIR, TFHUB_MODEL_LOAD_FORMAT, download locks, corrupt archives, or certificate validation sub-skills/load-and-wrap/references/load-resolve-cache.md
Wrap a Hub SavedModel in Keras, choose signature, output_key, signature_outputs_as_dict, output_shape, or trainable sub-skills/load-and-wrap/references/keras-layer.md
Use text_embedding_column_v2, DenseFeatures, or recover from hub.text_embedding_column_v2 AttributeError sub-skills/load-and-wrap/references/feature-column-v2.md
Create a TF2 SavedModel that can be consumed by TensorFlow Hub sub-skills/export-and-save/SKILL.md
Export text embeddings from a token/vector file sub-skills/export-and-save/references/text-embedding-export.md
Migrate or triage old TF1 hub.Module, create_module_spec, or add_signature snippets sub-skills/export-and-save/references/legacy-tf1-notes.md
Check whether this skill matches the current source checkout references/repo-provenance.md

Safe local validation

Before using a network-backed handle or a large model, run the no-download smoke script from the loading sub-skill:

python sub-skills/load-and-wrap/scripts/smoke_load_and_wrap.py --feature-column

For text embedding export tasks, use the bundled exporter under the export sub-skill:

python sub-skills/export-and-save/scripts/export_text_embeddings_v2.py --help

Both scripts create only temporary/local outputs chosen by the caller and do not read the original repository checkout.

Boundaries

Use this skill for:

  • loading or resolving TensorFlow Hub handles and local SavedModels;
  • Keras integration through hub.KerasLayer;
  • feature-column text embedding workflows through tensorflow_hub.feature_column_v2;
  • creating TF2 SavedModel exports that are meant to be reloaded by TensorFlow Hub;
  • text embedding SavedModel export from small or production token/vector files;
  • troubleshooting TensorFlow Hub import, cache, signature, and legacy API confusion.

Do not use this skill as the main route for:

  • general TensorFlow model training unrelated to TensorFlow Hub handles or exports;
  • deprecated TF1 image-retraining scripts;
  • TensorFlow Hub repository maintenance, Bazel release builds, or pull-request policy;
  • current code that assumes hub.Module, hub.create_module_spec, hub.add_signature, or top-level hub.text_embedding_column_v2 exist without first checking an older archived runtime.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351