Transformers documentation

一般的なユーティリティ

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

一般的なユーティリティ

このページでは、utils.py ファイルに含まれる Transformers の一般的なユーティリティ関数をすべて一覧にしています。

それらの多くは、ライブラリの一般的なコードを研究している場合にのみ有用です。

Enum と namedtuple

クラス transformers.utils.ExplicitEnum

< >

( valuenames = Nonemodule = Nonequalname = Nonetype = Nonestart = 1boundary = None )

値が不足している場合、より明示的なエラーメッセージを返すEnum。

クラス transformers.utils.PaddingStrategy

< >

( valuenames = Nonemodule = Nonequalname = Nonetype = Nonestart = 1boundary = None )

PreTrainedTokenizerBase.call() の padding 引数に指定可能な値。IDE でのタブ補完に便利です。

class transformers.TensorType

< >

( valuenames = Nonemodule = Nonequalname = Nonetype = Nonestart = 1boundary = None )

PreTrainedTokenizerBase.call() の return_tensors 引数に指定可能な値です。IDEでのタブ補完に便利です。

特別なデコレーター

transformers.add_start_docstrings

< >

( *docstr )

transformers.utils.add_start_docstrings_to_model_forward

< >

( *docstr )

transformers.add_end_docstrings

< >

( *docstr )

transformers.utils.add_code_sample_docstrings

< >

( *docstrprocessor_class = Nonecheckpoint = Noneoutput_type = Noneconfig_class = Nonemask = '[MASK]'qa_target_start_index = 14qa_target_end_index = 15model_cls = Nonemodality = Noneexpected_output = Noneexpected_loss = Nonereal_checkpoint = Nonerevision = None )

transformers.utils.replace_return_docstrings

< >

( output_type = Noneconfig_class = None )

その他のユーティリティ

class transformers.utils._LazyModule

< >

( name: strmodule_file: strimport_structure: dict[frozenset[str], dict[str, set[str]]]module_spec: _frozen_importlib.ModuleSpec | None = Noneextra_objects: dict[str, object] | None = Noneexplicit_import_shortcut: dict[str, list[str]] | None = None )

要求されたオブジェクトに対してのみ関連するインポートを実行するが、すべてのオブジェクトを公開するモジュールクラス。

Update on GitHub