Transformers
加入 Hugging Face 社群
並獲得增強的文件體驗
通用工具
本頁面列出了 utils.py
檔案中所有 Transformers 的通用工具函式。
其中大部分只有在您研究庫中的通用程式碼時才有用。
列舉和具名元組
class transformers.utils.ExplicitEnum
< 來源 > ( 值 名稱 = 無 模組 = 無 限定名 = 無 型別 = 無 開始 = 1 )
帶有更明確的缺失值錯誤訊息的列舉。
特殊裝飾器
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 = 無 檢查點 = 無 輸出型別 = 無 配置類 = 無 掩碼 = '[MASK]' qa_target_start_index = 14 qa_target_end_index = 15 模型類 = 無 模態 = 無 預期輸出 = 無 預期損失 = 無 真實檢查點 = 無 修訂 = 無 )
transformers.utils.replace_return_docstrings
< 來源 > ( 輸出型別 = 無 配置類 = 無 )
特殊屬性
class transformers.utils.cached_property
< 來源 > ( fget = 無 fset = 無 fdel = 無 文件 = 無 )
模擬 @property 但將輸出快取到成員變數中的描述符。
來自 tensorflow_datasets
Python 3.8 的 functools 中內建。
其他實用工具
class transformers.utils._LazyModule
< 來源 > ( 名稱: str 模組檔案: str 匯入結構: dict 模組規範: typing.Optional[_frozen_importlib.ModuleSpec] = 無 額外物件: typing.Optional[dict[str, object]] = 無 顯式匯入快捷方式: typing.Optional[dict[str, list[str]]] = 無 )
模組類,顯示所有物件,但僅在請求物件時才執行關聯的匯入。
< > 在 GitHub 上更新
© . This site is unofficial and not affiliated with Hugging Face, Inc.