通用工具
本页面列出了在文件utils.py
中找到的所有Transformers通用实用函数。
大多数这些内容只有在您研究库中的通用代码时才有用。
枚举和命名元组
类 transformers.utils.ExplicitEnum
< source >( value names = 无 module = 无 qualname = 无 type = 无 start = 1 )
枚举类型,为缺失值提供更明确的错误信息。
padding
参数在 PreTrainedTokenizerBase.call() 中的可能值。在 IDE 中用于自动补全。
return_tensors
参数在 PreTrainedTokenizerBase.call() 中的可能值。在 IDE 中用于自动补全。
特殊装饰器
transformers.utils.add_code_sample_docstrings
< source >( *docstr processor_class = None checkpoint = None output_type = None config_class = None mask = '[MASK]' qa_target_start_index = 14 qa_target_end_index = 15 model_cls = None modality = None expected_output = None expected_loss = None real_checkpoint = None revision = None )
特殊属性
模仿@property但将输出缓存在成员变量中的描述符。
来自 tensorflow_datasets
从Python 3.8开始内置在functools中。
其他工具
类 transformers.utils._LazyModule
< source >( name: str module_file: str import_structure: typing.Dict[typing.FrozenSet[str], typing.Dict[str, typing.Set[str]]] module_spec: ModuleSpec = None extra_objects: typing.Dict[str, object] = None )
模块类,展示所有对象,但仅在请求对象时执行相关的导入。