Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Introdução
O TensorFlow Hub hospeda modelos para diversas tarefas. Os modelos
da mesma tarefa são incentivados a implementar uma API comum para que os consumidores de modelos possam facilmente trocá-los sem modificar o código que os utiliza,
mesmo que venham de diferentes editores.
A meta é fazer com que a troca de modelos diferentes para a mesma tarefa
seja tão simples quanto a troca de um hiperparâmetro com valor de string. Dessa forma, os consumidores de modelos podem encontrar facilmente
o melhor para o problema.
A API SavedModel reutilizável define convenções gerais
de como carregar um SavedModel para um programa em Python e reutilizá-lo como
parte de um modelo maior do TensorFlow.
Uso básico:
obj=hub.load("path/to/model")# That's tf.saved_model.load() after download.outputs=obj(inputs,training=False)# Invokes the tf.function obj.__call__.
Para usuários da Keras, a classe hub.KerasLayer depende dessa API para unir o
SavedModel reutilizável como uma plataforma Keras (que protege os usuários da Keras dos detalhes) com entradas e saídas de acordo com as APIs listadas abaixo, específicas à tarefa.
[null,null,["Última atualização 2021-09-01 UTC."],[],[],null,["# Common SavedModel APIs for TF Hub\n\n\u003cbr /\u003e\n\nIntroduction\n------------\n\n[TensorFlow Hub](https://tfhub.dev) hosts models for a variety of tasks. Models\nfor the same task are encouraged to implement a common API so that model\nconsumers can easily exchange them without modifying the code that uses them,\neven if they come from different publishers.\n\nThe goal is to make exchanging different models for the same task as simple as\nswitching a string-valued hyperparameter. With that, model consumers can easily\nfind the best one for their problem.\n\nThis directory collects specifications of common APIs for models in the\n[TF2 SavedModel format](../tf2_saved_model). (It replaces the\n[Common Signatures](../common_signatures/index) for the now-deprecated\n[TF1 Hub format](../tf1_hub_module).)\n\nReusable SavedModel: the common foundation\n------------------------------------------\n\nThe [Reusable SavedModel API](../reusable_saved_models) defines general\nconventions how to load a SavedModel back into a Python program and reuse it as\npart of a bigger TensorFlow model.\n\nBasic usage: \n\n obj = hub.load(\"path/to/model\") # That's tf.saved_model.load() after download.\n outputs = obj(inputs, training=False) # Invokes the tf.function obj.__call__.\n\n| **Key Point:** This uses the object-based interface to restored SavedModels that was added in TensorFlow 2, not the SavedModel signatures for serving.\n\nFor Keras users, the [`hub.KerasLayer`](https://www.tensorflow.org/hub/api_docs/python/hub/KerasLayer) class relies on this API to wrap the\nReusable SavedModel as a Keras Layer (shielding Keras users from its details),\nwith inputs and outputs according to the task-specific APIs listed below.\n\nTask-specific APIs\n------------------\n\nThese refine the [Reusable SavedModel API](../reusable_saved_models) with\nconventions for particular ML tasks and types of data.\n\n- [Image tasks](/hub/common_saved_model_apis/images)\n- [Text tasks](/hub/common_saved_model_apis/text)"]]