Transformers documentation

일반 유틸리티 (General Utilities)

You are viewing v4.47.0 version. A newer version v4.47.1 is available.
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

일반 유틸리티 (General Utilities)

이 페이지는 utils.py 파일에 있는 Transformers의 일반 유틸리티 함수들을 나열합니다.

이 함수들 대부분은 라이브러리의 일반적인 코드를 연구할 때만 유용합니다.

Enums 및 namedtuples

class transformers.utils.ExplicitEnum

< >

( value names = None module = None qualname = None type = None start = 1 )

Enum with more explicit error message for missing values.

class transformers.utils.PaddingStrategy

< >

( value names = None module = None qualname = None type = None start = 1 )

Possible values for the padding argument in PreTrainedTokenizerBase.call(). Useful for tab-completion in an IDE.

class transformers.TensorType

< >

( value names = None module = None qualname = None type = None start = 1 )

Possible values for the return_tensors argument in PreTrainedTokenizerBase.call(). Useful for tab-completion in an IDE.

특수 데코레이터 (Special Decorators)

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

< >

( *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 )

transformers.utils.replace_return_docstrings

< >

( output_type = None config_class = None )

특수 속성 (Special Properties)

class transformers.utils.cached_property

< >

( fget = None fset = None fdel = None doc = None )

Descriptor that mimics @property but caches output in member variable.

From tensorflow_datasets

Built-in in functools from Python 3.8.

기타 유틸리티

class transformers.utils._LazyModule

< >

( 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 )

Module class that surfaces all objects but only performs associated imports when the objects are requested.

< > Update on GitHub