网页 综合 更新时间 2026-11-15 00:14:39

Task

自动蜘蛛 keras.io 正文约 1564 字
Task
Base class for all Task models.
A Task wraps a keras_hub.models.Backbone and a keras_hub.models.Preprocessor to create a model that can be directly used for training, fine-tuning, and prediction for a given text problem.
All Task models have backbone and preprocessor properties. By default fit(), predict() and evaluate() will preprocess all inputs automatically. To preprocess inputs separately or with a custom function, you can set task.preprocessor = None, which disable any automatic preprocessing on inputs.
All Task classes include a from_preset() constructor which can be used to load a pre-trained config and weights. Calling from_preset() on a task will automatically instantiate a keras_hub.models.Backbone and keras_hub.models.Preprocessor.
Instantiate a keras_hub.models.Task from a model preset.
A preset is a directory of configs, weights and other file assets used to save and load a pre-trained model. The preset can be passed as one of:
For any Task subclass, you can run cls.presets.keys() to list all built-in presets available on the class.
This constructor can be called in one of two ways. Either from a task specific base class like keras_hub.models.CausalLM.from_preset(), or from a model class like keras_hub.models.BertTextClassifier.from_preset(). If calling from the a base class, the subclass of the returning object will be inferred from the config in the preset directory.
Save task to a preset directory.
A keras_hub.models.Preprocessor layer used to preprocess input.
A keras_hub.models.Backbone model with the core architecture.
访问原文 返回搜索 https://keras.io/keras_hub/api/base_classes/task
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。