L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Productivité · SKILL.md

tensorflow-hub

tensorflow-hub

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

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

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

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 symptomRead next
Resolve or load a Hub handle, local SavedModel path, tfhub.dev/Kaggle Models URL, or archivesub-skills/load-and-wrap/SKILL.md
Diagnose TFHUB_CACHE_DIR, TFHUB_MODEL_LOAD_FORMAT, download locks, corrupt archives, or certificate validationsub-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 trainablesub-skills/load-and-wrap/references/keras-layer.md
Use text_embedding_column_v2, DenseFeatures, or recover from hub.text_embedding_column_v2 AttributeErrorsub-skills/load-and-wrap/references/feature-column-v2.md
Create a TF2 SavedModel that can be consumed by TensorFlow Hubsub-skills/export-and-save/SKILL.md
Export text embeddings from a token/vector filesub-skills/export-and-save/references/text-embedding-export.md
Migrate or triage old TF1 hub.Module, create_module_spec, or add_signature snippetssub-skills/export-and-save/references/legacy-tf1-notes.md
Check whether this skill matches the current source checkoutreferences/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.
Skills enregistrées