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의 모든 일반 유틸리티 함수를 나열합니다.

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

Enums 및 namedtuples

클래스 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에서 탭 완성(tab-completion)에 유용합니다.

클래스 transformers.TensorType

< >

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

PreTrainedTokenizerBase.call()의 return_tensors 인자에서 사용할 수 있는 값입니다. IDE에서 탭 완성(tab-completion)에 유용합니다.

특수 데코레이터

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 )

기타 유틸리티

클래스 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