codekingpro/portable-devtools
114k
1# Copyright 2020 The HuggingFace Team. All rights reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14 15# ***********16# `huggingface_hub` init has 2 modes:17# - Normal usage:18# If imported to use it, all modules and functions are lazy-loaded. This means19# they exist at top level in module but are imported only the first time they are20# used. This way, `from huggingface_hub import something` will import `something`21# quickly without the hassle of importing all the features from `huggingface_hub`.22# - Static check:23# If statically analyzed, all modules and functions are loaded normally. This way24# static typing check works properly as well as autocomplete in text editors and25# IDEs.26#27# The static model imports are done inside the `if TYPE_CHECKING:` statement at28# the bottom of this file. Since module/functions imports are duplicated, it is29# mandatory to make sure to add them twice when adding one. This is checked in the30# `make quality` command.31#32# To update the static imports, please run the following command and commit the changes.33# ```34# # Use script35# python utils/check_static_imports.py --update-file36#37# # Or run style on codebase38# make style39# ```40#41# ***********42# Lazy loader vendored from https://github.com/scientific-python/lazy_loader43import importlib44import os45import sys46from typing import TYPE_CHECKING47 48 49__version__ = "1.14.0"50 51# Alphabetical order of definitions is ensured in tests52# WARNING: any comment added in this dictionary definition will be lost when53# re-generating the file !54_SUBMOD_ATTRS = {55 "_buckets": [56 "BucketFile",57 "BucketFileMetadata",58 "BucketFolder",59 "BucketInfo",60 "BucketUrl",61 "SyncOperation",62 "SyncPlan",63 ],64 "_commit_scheduler": [65 "CommitScheduler",66 ],67 "_eval_results": [68 "EvalResultEntry",69 "eval_result_entries_to_yaml",70 "parse_eval_result_entries",71 ],72 "_inference_endpoints": [73 "InferenceEndpoint",74 "InferenceEndpointError",75 "InferenceEndpointStatus",76 "InferenceEndpointTimeoutError",77 "InferenceEndpointType",78 ],79 "_jobs_api": [80 "JobAccelerator",81 "JobHardware",82 "JobInfo",83 "JobOwner",84 "JobStage",85 "JobStatus",86 ],87 "_login": [88 "auth_list",89 "auth_switch",90 "interpreter_login",91 "login",92 "logout",93 "notebook_login",94 ],95 "_oauth": [96 "OAuthInfo",97 "OAuthOrgInfo",98 "OAuthUserInfo",99 "attach_huggingface_oauth",100 "parse_huggingface_oauth",101 ],102 "_snapshot_download": [103 "snapshot_download",104 ],105 "_space_api": [106 "SpaceHardware",107 "SpaceRuntime",108 "SpaceSecret",109 "SpaceStage",110 "SpaceStorage",111 "SpaceVariable",112 "Volume",113 ],114 "_tensorboard_logger": [115 "HFSummaryWriter",116 ],117 "_webhooks_payload": [118 "WebhookPayload",119 "WebhookPayloadComment",120 "WebhookPayloadDiscussion",121 "WebhookPayloadDiscussionChanges",122 "WebhookPayloadEvent",123 "WebhookPayloadMovedTo",124 "WebhookPayloadRepo",125 "WebhookPayloadUrl",126 "WebhookPayloadWebhook",127 ],128 "_webhooks_server": [129 "WebhooksServer",130 "webhook_endpoint",131 ],132 "cli._cli_utils": [133 "check_cli_update",134 "typer_factory",135 ],136 "community": [137 "Discussion",138 "DiscussionComment",139 "DiscussionCommit",140 "DiscussionEvent",141 "DiscussionStatusChange",142 "DiscussionTitleChange",143 "DiscussionWithDetails",144 ],145 "constants": [146 "CONFIG_NAME",147 "FLAX_WEIGHTS_NAME",148 "HUGGINGFACE_CO_URL_HOME",149 "HUGGINGFACE_CO_URL_TEMPLATE",150 "PYTORCH_WEIGHTS_NAME",151 "REPO_TYPE_DATASET",152 "REPO_TYPE_MODEL",153 "REPO_TYPE_SPACE",154 "TF2_WEIGHTS_NAME",155 "TF_WEIGHTS_NAME",156 "is_offline_mode",157 ],158 "fastai_utils": [159 "_save_pretrained_fastai",160 "from_pretrained_fastai",161 "push_to_hub_fastai",162 ],163 "file_download": [164 "DryRunFileInfo",165 "HfFileMetadata",166 "_CACHED_NO_EXIST",167 "get_hf_file_metadata",168 "hf_hub_download",169 "hf_hub_url",170 "try_to_load_from_cache",171 ],172 "hf_api": [173 "Collection",174 "CollectionItem",175 "CommitInfo",176 "CommitOperation",177 "CommitOperationAdd",178 "CommitOperationCopy",179 "CommitOperationDelete",180 "DatasetInfo",181 "DatasetLeaderboardEntry",182 "GitCommitInfo",183 "GitRefInfo",184 "GitRefs",185 "HfApi",186 "KernelInfo",187 "ModelInfo",188 "Organization",189 "RepoFile",190 "RepoFolder",191 "RepoUrl",192 "SpaceInfo",193 "SpaceSearchResult",194 "User",195 "UserLikes",196 "WebhookInfo",197 "WebhookWatchedItem",198 "accept_access_request",199 "add_collection_item",200 "add_space_secret",201 "add_space_variable",202 "auth_check",203 "batch_bucket_files",204 "bucket_info",205 "cancel_access_request",206 "cancel_job",207 "change_discussion_status",208 "comment_discussion",209 "copy_files",210 "create_branch",211 "create_bucket",212 "create_collection",213 "create_commit",214 "create_discussion",215 "create_inference_endpoint",216 "create_inference_endpoint_from_catalog",217 "create_pull_request",218 "create_repo",219 "create_scheduled_job",220 "create_scheduled_uv_job",221 "create_tag",222 "create_webhook",223 "dataset_info",224 "delete_branch",225 "delete_bucket",226 "delete_collection",227 "delete_collection_item",228 "delete_file",229 "delete_folder",230 "delete_inference_endpoint",231 "delete_repo",232 "delete_scheduled_job",233 "delete_space_secret",234 "delete_space_storage",235 "delete_space_variable",236 "delete_space_volumes",237 "delete_tag",238 "delete_webhook",239 "disable_space_dev_mode",240 "disable_webhook",241 "download_bucket_files",242 "duplicate_repo",243 "duplicate_space",244 "edit_discussion_comment",245 "enable_space_dev_mode",246 "enable_webhook",247 "fetch_job_logs",248 "fetch_job_metrics",249 "fetch_space_logs",250 "file_exists",251 "get_bucket_file_metadata",252 "get_bucket_paths_info",253 "get_collection",254 "get_dataset_leaderboard",255 "get_dataset_tags",256 "get_discussion_details",257 "get_full_repo_name",258 "get_inference_endpoint",259 "get_local_safetensors_metadata",260 "get_model_tags",261 "get_organization_overview",262 "get_paths_info",263 "get_repo_discussions",264 "get_safetensors_metadata",265 "get_space_runtime",266 "get_space_secrets",267 "get_space_variables",268 "get_user_overview",269 "get_webhook",270 "grant_access",271 "inspect_job",272 "inspect_scheduled_job",273 "kernel_info",274 "list_accepted_access_requests",275 "list_bucket_tree",276 "list_buckets",277 "list_collections",278 "list_daily_papers",279 "list_dataset_parquet_files",280 "list_datasets",281 "list_inference_catalog",282 "list_inference_endpoints",283 "list_jobs",284 "list_jobs_hardware",285 "list_lfs_files",286 "list_liked_repos",287 "list_models",288 "list_organization_followers",289 "list_organization_members",290 "list_papers",291 "list_pending_access_requests",292 "list_rejected_access_requests",293 "list_repo_commits",294 "list_repo_files",295 "list_repo_likers",296 "list_repo_refs",297 "list_repo_tree",298 "list_spaces",299 "list_spaces_hardware",300 "list_user_followers",301 "list_user_following",302 "list_webhooks",303 "merge_pull_request",304 "model_info",305 "move_bucket",306 "move_repo",307 "paper_info",308 "parse_local_safetensors_file_metadata",309 "parse_safetensors_file_metadata",310 "pause_inference_endpoint",311 "pause_space",312 "permanently_delete_lfs_files",313 "preupload_lfs_files",314 "read_paper",315 "reject_access_request",316 "rename_discussion",317 "repo_exists",318 "repo_info",319 "repo_type_and_id_from_hf_id",320 "request_space_hardware",321 "request_space_storage",322 "restart_space",323 "resume_inference_endpoint",324 "resume_scheduled_job",325 "revision_exists",326 "run_as_future",327 "run_job",328 "run_uv_job",329 "scale_to_zero_inference_endpoint",330 "search_spaces",331 "set_space_sleep_time",332 "set_space_volumes",333 "space_info",334 "super_squash_history",335 "suspend_scheduled_job",336 "sync_bucket",337 "unlike",338 "update_collection_item",339 "update_collection_metadata",340 "update_inference_endpoint",341 "update_repo_settings",342 "update_webhook",343 "upload_file",344 "upload_folder",345 "upload_large_folder",346 "verify_repo_checksums",347 "whoami",348 ],349 "hf_file_system": [350 "HfFileSystem",351 "HfFileSystemFile",352 "HfFileSystemResolvedPath",353 "HfFileSystemStreamFile",354 "hffs",355 ],356 "hub_mixin": [357 "ModelHubMixin",358 "PyTorchModelHubMixin",359 ],360 "inference._client": [361 "InferenceClient",362 "InferenceTimeoutError",363 ],364 "inference._generated._async_client": [365 "AsyncInferenceClient",366 ],367 "inference._generated.types": [368 "AudioClassificationInput",369 "AudioClassificationOutputElement",370 "AudioClassificationOutputTransform",371 "AudioClassificationParameters",372 "AudioToAudioInput",373 "AudioToAudioOutputElement",374 "AutomaticSpeechRecognitionEarlyStoppingEnum",375 "AutomaticSpeechRecognitionGenerationParameters",376 "AutomaticSpeechRecognitionInput",377 "AutomaticSpeechRecognitionOutput",378 "AutomaticSpeechRecognitionOutputChunk",379 "AutomaticSpeechRecognitionParameters",380 "ChatCompletionInput",381 "ChatCompletionInputFunctionDefinition",382 "ChatCompletionInputFunctionName",383 "ChatCompletionInputGrammarType",384 "ChatCompletionInputJSONSchema",385 "ChatCompletionInputMessage",386 "ChatCompletionInputMessageChunk",387 "ChatCompletionInputMessageChunkType",388 "ChatCompletionInputResponseFormatJSONObject",389 "ChatCompletionInputResponseFormatJSONSchema",390 "ChatCompletionInputResponseFormatText",391 "ChatCompletionInputStreamOptions",392 "ChatCompletionInputTool",393 "ChatCompletionInputToolCall",394 "ChatCompletionInputToolChoiceClass",395 "ChatCompletionInputToolChoiceEnum",396 "ChatCompletionInputURL",397 "ChatCompletionOutput",398 "ChatCompletionOutputComplete",399 "ChatCompletionOutputFunctionDefinition",400 "ChatCompletionOutputLogprob",401 "ChatCompletionOutputLogprobs",402 "ChatCompletionOutputMessage",403 "ChatCompletionOutputToolCall",404 "ChatCompletionOutputTopLogprob",405 "ChatCompletionOutputUsage",406 "ChatCompletionStreamOutput",407 "ChatCompletionStreamOutputChoice",408 "ChatCompletionStreamOutputDelta",409 "ChatCompletionStreamOutputDeltaToolCall",410 "ChatCompletionStreamOutputFunction",411 "ChatCompletionStreamOutputLogprob",412 "ChatCompletionStreamOutputLogprobs",413 "ChatCompletionStreamOutputTopLogprob",414 "ChatCompletionStreamOutputUsage",415 "DepthEstimationInput",416 "DepthEstimationOutput",417 "DocumentQuestionAnsweringInput",418 "DocumentQuestionAnsweringInputData",419 "DocumentQuestionAnsweringOutputElement",420 "DocumentQuestionAnsweringParameters",421 "FeatureExtractionInput",422 "FeatureExtractionInputTruncationDirection",423 "FillMaskInput",424 "FillMaskOutputElement",425 "FillMaskParameters",426 "ImageClassificationInput",427 "ImageClassificationOutputElement",428 "ImageClassificationOutputTransform",429 "ImageClassificationParameters",430 "ImageSegmentationInput",431 "ImageSegmentationOutputElement",432 "ImageSegmentationParameters",433 "ImageSegmentationSubtask",434 "ImageTextToImageInput",435 "ImageTextToImageOutput",436 "ImageTextToImageParameters",437 "ImageTextToImageTargetSize",438 "ImageTextToVideoInput",439 "ImageTextToVideoOutput",440 "ImageTextToVideoParameters",441 "ImageTextToVideoTargetSize",442 "ImageToImageInput",443 "ImageToImageOutput",444 "ImageToImageParameters",445 "ImageToImageTargetSize",446 "ImageToTextEarlyStoppingEnum",447 "ImageToTextGenerationParameters",448 "ImageToTextInput",449 "ImageToTextOutput",450 "ImageToTextParameters",451 "ImageToVideoInput",452 "ImageToVideoOutput",453 "ImageToVideoParameters",454 "ImageToVideoTargetSize",455 "ObjectDetectionBoundingBox",456 "ObjectDetectionInput",457 "ObjectDetectionOutputElement",458 "ObjectDetectionParameters",459 "Padding",460 "QuestionAnsweringInput",461 "QuestionAnsweringInputData",462 "QuestionAnsweringOutputElement",463 "QuestionAnsweringParameters",464 "SentenceSimilarityInput",465 "SentenceSimilarityInputData",466 "SummarizationInput",467 "SummarizationOutput",468 "SummarizationParameters",469 "SummarizationTruncationStrategy",470 "TableQuestionAnsweringInput",471 "TableQuestionAnsweringInputData",472 "TableQuestionAnsweringOutputElement",473 "TableQuestionAnsweringParameters",474 "Text2TextGenerationInput",475 "Text2TextGenerationOutput",476 "Text2TextGenerationParameters",477 "Text2TextGenerationTruncationStrategy",478 "TextClassificationInput",479 "TextClassificationOutputElement",480 "TextClassificationOutputTransform",481 "TextClassificationParameters",482 "TextGenerationInput",483 "TextGenerationInputGenerateParameters",484 "TextGenerationInputGrammarType",485 "TextGenerationOutput",486 "TextGenerationOutputBestOfSequence",487 "TextGenerationOutputDetails",488 "TextGenerationOutputFinishReason",489 "TextGenerationOutputPrefillToken",490 "TextGenerationOutputToken",491 "TextGenerationStreamOutput",492 "TextGenerationStreamOutputStreamDetails",493 "TextGenerationStreamOutputToken",494 "TextToAudioEarlyStoppingEnum",495 "TextToAudioGenerationParameters",496 "TextToAudioInput",497 "TextToAudioOutput",498 "TextToAudioParameters",499 "TextToImageInput",500 "TextToImageOutput",501 "TextToImageParameters",502 "TextToSpeechEarlyStoppingEnum",503 "TextToSpeechGenerationParameters",504 "TextToSpeechInput",505 "TextToSpeechOutput",506 "TextToSpeechParameters",507 "TextToVideoInput",508 "TextToVideoOutput",509 "TextToVideoParameters",510 "TokenClassificationAggregationStrategy",511 "TokenClassificationInput",512 "TokenClassificationOutputElement",513 "TokenClassificationParameters",514 "TranslationInput",515 "TranslationOutput",516 "TranslationParameters",517 "TranslationTruncationStrategy",518 "TypeEnum",519 "VideoClassificationInput",520 "VideoClassificationOutputElement",521 "VideoClassificationOutputTransform",522 "VideoClassificationParameters",523 "VisualQuestionAnsweringInput",524 "VisualQuestionAnsweringInputData",525 "VisualQuestionAnsweringOutputElement",526 "VisualQuestionAnsweringParameters",527 "ZeroShotClassificationInput",528 "ZeroShotClassificationOutputElement",529 "ZeroShotClassificationParameters",530 "ZeroShotImageClassificationInput",531 "ZeroShotImageClassificationOutputElement",532 "ZeroShotImageClassificationParameters",533 "ZeroShotObjectDetectionBoundingBox",534 "ZeroShotObjectDetectionInput",535 "ZeroShotObjectDetectionOutputElement",536 "ZeroShotObjectDetectionParameters",537 ],538 "inference._mcp.agent": [539 "Agent",540 ],541 "inference._mcp.mcp_client": [542 "MCPClient",543 ],544 "repocard": [545 "DatasetCard",546 "ModelCard",547 "RepoCard",548 "SpaceCard",549 "metadata_eval_result",550 "metadata_load",551 "metadata_save",552 "metadata_update",553 ],554 "repocard_data": [555 "CardData",556 "DatasetCardData",557 "EvalResult",558 "ModelCardData",559 "SpaceCardData",560 ],561 "serialization": [562 "StateDictSplit",563 "get_torch_storage_id",564 "get_torch_storage_size",565 "load_state_dict_from_file",566 "load_torch_model",567 "save_torch_model",568 "save_torch_state_dict",569 "split_state_dict_into_shards_factory",570 "split_torch_state_dict_into_shards",571 ],572 "serialization._dduf": [573 "DDUFEntry",574 "export_entries_as_dduf",575 "export_folder_as_dduf",576 "read_dduf_file",577 ],578 "utils": [579 "ASYNC_CLIENT_FACTORY_T",580 "CLIENT_FACTORY_T",581 "CacheNotFound",582 "CachedFileInfo",583 "CachedRepoInfo",584 "CachedRevisionInfo",585 "CorruptedCacheException",586 "DeleteCacheStrategy",587 "HFCacheInfo",588 "HfUri",589 "cached_assets_path",590 "close_session",591 "dump_environment_info",592 "get_async_session",593 "get_session",594 "get_token",595 "hf_raise_for_status",596 "logging",597 "parse_hf_uri",598 "scan_cache_dir",599 "set_async_client_factory",600 "set_client_factory",601 ],602}603 604# WARNING: __all__ is generated automatically, Any manual edit will be lost when re-generating this file !605#606# To update the static imports, please run the following command and commit the changes.607# ```608# # Use script609# python utils/check_all_variable.py --update610#611# # Or run style on codebase612# make style613# ```614 615__all__ = [616 "ASYNC_CLIENT_FACTORY_T",617 "Agent",618 "AsyncInferenceClient",619 "AudioClassificationInput",620 "AudioClassificationOutputElement",621 "AudioClassificationOutputTransform",622 "AudioClassificationParameters",623 "AudioToAudioInput",624 "AudioToAudioOutputElement",625 "AutomaticSpeechRecognitionEarlyStoppingEnum",626 "AutomaticSpeechRecognitionGenerationParameters",627 "AutomaticSpeechRecognitionInput",628 "AutomaticSpeechRecognitionOutput",629 "AutomaticSpeechRecognitionOutputChunk",630 "AutomaticSpeechRecognitionParameters",631 "BucketFile",632 "BucketFileMetadata",633 "BucketFolder",634 "BucketInfo",635 "BucketUrl",636 "CLIENT_FACTORY_T",637 "CONFIG_NAME",638 "CacheNotFound",639 "CachedFileInfo",640 "CachedRepoInfo",641 "CachedRevisionInfo",642 "CardData",643 "ChatCompletionInput",644 "ChatCompletionInputFunctionDefinition",645 "ChatCompletionInputFunctionName",646 "ChatCompletionInputGrammarType",647 "ChatCompletionInputJSONSchema",648 "ChatCompletionInputMessage",649 "ChatCompletionInputMessageChunk",650 "ChatCompletionInputMessageChunkType",651 "ChatCompletionInputResponseFormatJSONObject",652 "ChatCompletionInputResponseFormatJSONSchema",653 "ChatCompletionInputResponseFormatText",654 "ChatCompletionInputStreamOptions",655 "ChatCompletionInputTool",656 "ChatCompletionInputToolCall",657 "ChatCompletionInputToolChoiceClass",658 "ChatCompletionInputToolChoiceEnum",659 "ChatCompletionInputURL",660 "ChatCompletionOutput",661 "ChatCompletionOutputComplete",662 "ChatCompletionOutputFunctionDefinition",663 "ChatCompletionOutputLogprob",664 "ChatCompletionOutputLogprobs",665 "ChatCompletionOutputMessage",666 "ChatCompletionOutputToolCall",667 "ChatCompletionOutputTopLogprob",668 "ChatCompletionOutputUsage",669 "ChatCompletionStreamOutput",670 "ChatCompletionStreamOutputChoice",671 "ChatCompletionStreamOutputDelta",672 "ChatCompletionStreamOutputDeltaToolCall",673 "ChatCompletionStreamOutputFunction",674 "ChatCompletionStreamOutputLogprob",675 "ChatCompletionStreamOutputLogprobs",676 "ChatCompletionStreamOutputTopLogprob",677 "ChatCompletionStreamOutputUsage",678 "Collection",679 "CollectionItem",680 "CommitInfo",681 "CommitOperation",682 "CommitOperationAdd",683 "CommitOperationCopy",684 "CommitOperationDelete",685 "CommitScheduler",686 "CorruptedCacheException",687 "DDUFEntry",688 "DatasetCard",689 "DatasetCardData",690 "DatasetInfo",691 "DatasetLeaderboardEntry",692 "DeleteCacheStrategy",693 "DepthEstimationInput",694 "DepthEstimationOutput",695 "Discussion",696 "DiscussionComment",697 "DiscussionCommit",698 "DiscussionEvent",699 "DiscussionStatusChange",700 "DiscussionTitleChange",701 "DiscussionWithDetails",702 "DocumentQuestionAnsweringInput",703 "DocumentQuestionAnsweringInputData",704 "DocumentQuestionAnsweringOutputElement",705 "DocumentQuestionAnsweringParameters",706 "DryRunFileInfo",707 "EvalResult",708 "EvalResultEntry",709 "FLAX_WEIGHTS_NAME",710 "FeatureExtractionInput",711 "FeatureExtractionInputTruncationDirection",712 "FillMaskInput",713 "FillMaskOutputElement",714 "FillMaskParameters",715 "GitCommitInfo",716 "GitRefInfo",717 "GitRefs",718 "HFCacheInfo",719 "HFSummaryWriter",720 "HUGGINGFACE_CO_URL_HOME",721 "HUGGINGFACE_CO_URL_TEMPLATE",722 "HfApi",723 "HfFileMetadata",724 "HfFileSystem",725 "HfFileSystemFile",726 "HfFileSystemResolvedPath",727 "HfFileSystemStreamFile",728 "HfUri",729 "ImageClassificationInput",730 "ImageClassificationOutputElement",731 "ImageClassificationOutputTransform",732 "ImageClassificationParameters",733 "ImageSegmentationInput",734 "ImageSegmentationOutputElement",735 "ImageSegmentationParameters",736 "ImageSegmentationSubtask",737 "ImageTextToImageInput",738 "ImageTextToImageOutput",739 "ImageTextToImageParameters",740 "ImageTextToImageTargetSize",741 "ImageTextToVideoInput",742 "ImageTextToVideoOutput",743 "ImageTextToVideoParameters",744 "ImageTextToVideoTargetSize",745 "ImageToImageInput",746 "ImageToImageOutput",747 "ImageToImageParameters",748 "ImageToImageTargetSize",749 "ImageToTextEarlyStoppingEnum",750 "ImageToTextGenerationParameters",751 "ImageToTextInput",752 "ImageToTextOutput",753 "ImageToTextParameters",754 "ImageToVideoInput",755 "ImageToVideoOutput",756 "ImageToVideoParameters",757 "ImageToVideoTargetSize",758 "InferenceClient",759 "InferenceEndpoint",760 "InferenceEndpointError",761 "InferenceEndpointStatus",762 "InferenceEndpointTimeoutError",763 "InferenceEndpointType",764 "InferenceTimeoutError",765 "JobAccelerator",766 "JobHardware",767 "JobInfo",768 "JobOwner",769 "JobStage",770 "JobStatus",771 "KernelInfo",772 "MCPClient",773 "ModelCard",774 "ModelCardData",775 "ModelHubMixin",776 "ModelInfo",777 "OAuthInfo",778 "OAuthOrgInfo",779 "OAuthUserInfo",780 "ObjectDetectionBoundingBox",781 "ObjectDetectionInput",782 "ObjectDetectionOutputElement",783 "ObjectDetectionParameters",784 "Organization",785 "PYTORCH_WEIGHTS_NAME",786 "Padding",787 "PyTorchModelHubMixin",788 "QuestionAnsweringInput",789 "QuestionAnsweringInputData",790 "QuestionAnsweringOutputElement",791 "QuestionAnsweringParameters",792 "REPO_TYPE_DATASET",793 "REPO_TYPE_MODEL",794 "REPO_TYPE_SPACE",795 "RepoCard",796 "RepoFile",797 "RepoFolder",798 "RepoUrl",799 "SentenceSimilarityInput",800 "SentenceSimilarityInputData",801 "SpaceCard",802 "SpaceCardData",803 "SpaceHardware",804 "SpaceInfo",805 "SpaceRuntime",806 "SpaceSearchResult",807 "SpaceSecret",808 "SpaceStage",809 "SpaceStorage",810 "SpaceVariable",811 "StateDictSplit",812 "SummarizationInput",813 "SummarizationOutput",814 "SummarizationParameters",815 "SummarizationTruncationStrategy",816 "SyncOperation",817 "SyncPlan",818 "TF2_WEIGHTS_NAME",819 "TF_WEIGHTS_NAME",820 "TableQuestionAnsweringInput",821 "TableQuestionAnsweringInputData",822 "TableQuestionAnsweringOutputElement",823 "TableQuestionAnsweringParameters",824 "Text2TextGenerationInput",825 "Text2TextGenerationOutput",826 "Text2TextGenerationParameters",827 "Text2TextGenerationTruncationStrategy",828 "TextClassificationInput",829 "TextClassificationOutputElement",830 "TextClassificationOutputTransform",831 "TextClassificationParameters",832 "TextGenerationInput",833 "TextGenerationInputGenerateParameters",834 "TextGenerationInputGrammarType",835 "TextGenerationOutput",836 "TextGenerationOutputBestOfSequence",837 "TextGenerationOutputDetails",838 "TextGenerationOutputFinishReason",839 "TextGenerationOutputPrefillToken",840 "TextGenerationOutputToken",841 "TextGenerationStreamOutput",842 "TextGenerationStreamOutputStreamDetails",843 "TextGenerationStreamOutputToken",844 "TextToAudioEarlyStoppingEnum",845 "TextToAudioGenerationParameters",846 "TextToAudioInput",847 "TextToAudioOutput",848 "TextToAudioParameters",849 "TextToImageInput",850 "TextToImageOutput",851 "TextToImageParameters",852 "TextToSpeechEarlyStoppingEnum",853 "TextToSpeechGenerationParameters",854 "TextToSpeechInput",855 "TextToSpeechOutput",856 "TextToSpeechParameters",857 "TextToVideoInput",858 "TextToVideoOutput",859 "TextToVideoParameters",860 "TokenClassificationAggregationStrategy",861 "TokenClassificationInput",862 "TokenClassificationOutputElement",863 "TokenClassificationParameters",864 "TranslationInput",865 "TranslationOutput",866 "TranslationParameters",867 "TranslationTruncationStrategy",868 "TypeEnum",869 "User",870 "UserLikes",871 "VideoClassificationInput",872 "VideoClassificationOutputElement",873 "VideoClassificationOutputTransform",874 "VideoClassificationParameters",875 "VisualQuestionAnsweringInput",876 "VisualQuestionAnsweringInputData",877 "VisualQuestionAnsweringOutputElement",878 "VisualQuestionAnsweringParameters",879 "Volume",880 "WebhookInfo",881 "WebhookPayload",882 "WebhookPayloadComment",883 "WebhookPayloadDiscussion",884 "WebhookPayloadDiscussionChanges",885 "WebhookPayloadEvent",886 "WebhookPayloadMovedTo",887 "WebhookPayloadRepo",888 "WebhookPayloadUrl",889 "WebhookPayloadWebhook",890 "WebhookWatchedItem",891 "WebhooksServer",892 "ZeroShotClassificationInput",893 "ZeroShotClassificationOutputElement",894 "ZeroShotClassificationParameters",895 "ZeroShotImageClassificationInput",896 "ZeroShotImageClassificationOutputElement",897 "ZeroShotImageClassificationParameters",898 "ZeroShotObjectDetectionBoundingBox",899 "ZeroShotObjectDetectionInput",900 "ZeroShotObjectDetectionOutputElement",901 "ZeroShotObjectDetectionParameters",902 "_CACHED_NO_EXIST",903 "_save_pretrained_fastai",904 "accept_access_request",905 "add_collection_item",906 "add_space_secret",907 "add_space_variable",908 "attach_huggingface_oauth",909 "auth_check",910 "auth_list",911 "auth_switch",912 "batch_bucket_files",913 "bucket_info",914 "cached_assets_path",915 "cancel_access_request",916 "cancel_job",917 "change_discussion_status",918 "check_cli_update",919 "close_session",920 "comment_discussion",921 "copy_files",922 "create_branch",923 "create_bucket",924 "create_collection",925 "create_commit",926 "create_discussion",927 "create_inference_endpoint",928 "create_inference_endpoint_from_catalog",929 "create_pull_request",930 "create_repo",931 "create_scheduled_job",932 "create_scheduled_uv_job",933 "create_tag",934 "create_webhook",935 "dataset_info",936 "delete_branch",937 "delete_bucket",938 "delete_collection",939 "delete_collection_item",940 "delete_file",941 "delete_folder",942 "delete_inference_endpoint",943 "delete_repo",944 "delete_scheduled_job",945 "delete_space_secret",946 "delete_space_storage",947 "delete_space_variable",948 "delete_space_volumes",949 "delete_tag",950 "delete_webhook",951 "disable_space_dev_mode",952 "disable_webhook",953 "download_bucket_files",954 "dump_environment_info",955 "duplicate_repo",956 "duplicate_space",957 "edit_discussion_comment",958 "enable_space_dev_mode",959 "enable_webhook",960 "eval_result_entries_to_yaml",961 "export_entries_as_dduf",962 "export_folder_as_dduf",963 "fetch_job_logs",964 "fetch_job_metrics",965 "fetch_space_logs",966 "file_exists",967 "from_pretrained_fastai",968 "get_async_session",969 "get_bucket_file_metadata",970 "get_bucket_paths_info",971 "get_collection",972 "get_dataset_leaderboard",973 "get_dataset_tags",974 "get_discussion_details",975 "get_full_repo_name",976 "get_hf_file_metadata",977 "get_inference_endpoint",978 "get_local_safetensors_metadata",979 "get_model_tags",980 "get_organization_overview",981 "get_paths_info",982 "get_repo_discussions",983 "get_safetensors_metadata",984 "get_session",985 "get_space_runtime",986 "get_space_secrets",987 "get_space_variables",988 "get_token",989 "get_torch_storage_id",990 "get_torch_storage_size",991 "get_user_overview",992 "get_webhook",993 "grant_access",994 "hf_hub_download",995 "hf_hub_url",996 "hf_raise_for_status",997 "hffs",998 "inspect_job",999 "inspect_scheduled_job",1000 "interpreter_login",1001 "is_offline_mode",1002 "kernel_info",1003 "list_accepted_access_requests",1004 "list_bucket_tree",1005 "list_buckets",1006 "list_collections",1007 "list_daily_papers",1008 "list_dataset_parquet_files",1009 "list_datasets",1010 "list_inference_catalog",1011 "list_inference_endpoints",1012 "list_jobs",1013 "list_jobs_hardware",1014 "list_lfs_files",1015 "list_liked_repos",1016 "list_models",1017 "list_organization_followers",1018 "list_organization_members",1019 "list_papers",1020 "list_pending_access_requests",1021 "list_rejected_access_requests",1022 "list_repo_commits",1023 "list_repo_files",1024 "list_repo_likers",1025 "list_repo_refs",1026 "list_repo_tree",1027 "list_spaces",1028 "list_spaces_hardware",1029 "list_user_followers",1030 "list_user_following",1031 "list_webhooks",1032 "load_state_dict_from_file",1033 "load_torch_model",1034 "logging",1035 "login",1036 "logout",1037 "merge_pull_request",1038 "metadata_eval_result",1039 "metadata_load",1040 "metadata_save",1041 "metadata_update",1042 "model_info",1043 "move_bucket",1044 "move_repo",1045 "notebook_login",1046 "paper_info",1047 "parse_eval_result_entries",1048 "parse_hf_uri",1049 "parse_huggingface_oauth",1050 "parse_local_safetensors_file_metadata",1051 "parse_safetensors_file_metadata",1052 "pause_inference_endpoint",1053 "pause_space",1054 "permanently_delete_lfs_files",1055 "preupload_lfs_files",1056 "push_to_hub_fastai",1057 "read_dduf_file",1058 "read_paper",1059 "reject_access_request",1060 "rename_discussion",1061 "repo_exists",1062 "repo_info",1063 "repo_type_and_id_from_hf_id",1064 "request_space_hardware",1065 "request_space_storage",1066 "restart_space",1067 "resume_inference_endpoint",1068 "resume_scheduled_job",1069 "revision_exists",1070 "run_as_future",1071 "run_job",1072 "run_uv_job",1073 "save_torch_model",1074 "save_torch_state_dict",1075 "scale_to_zero_inference_endpoint",1076 "scan_cache_dir",1077 "search_spaces",1078 "set_async_client_factory",1079 "set_client_factory",1080 "set_space_sleep_time",1081 "set_space_volumes",1082 "snapshot_download",1083 "space_info",1084 "split_state_dict_into_shards_factory",1085 "split_torch_state_dict_into_shards",1086 "super_squash_history",1087 "suspend_scheduled_job",1088 "sync_bucket",1089 "try_to_load_from_cache",1090 "typer_factory",1091 "unlike",1092 "update_collection_item",1093 "update_collection_metadata",1094 "update_inference_endpoint",1095 "update_repo_settings",1096 "update_webhook",1097 "upload_file",1098 "upload_folder",1099 "upload_large_folder",1100 "verify_repo_checksums",1101 "webhook_endpoint",1102 "whoami",1103]1104 1105 1106def _attach(package_name, submodules=None, submod_attrs=None):1107 """Attach lazily loaded submodules, functions, or other attributes.1108 1109 Typically, modules import submodules and attributes as follows:1110 1111 ```py1112 import mysubmodule1113 import anothersubmodule1114 1115 from .foo import someattr1116 ```1117 1118 The idea is to replace a package's `__getattr__`, `__dir__`, such that all imports1119 work exactly the way they would with normal imports, except that the import occurs1120 upon first use.1121 1122 The typical way to call this function, replacing the above imports, is:1123 1124 ```python1125 __getattr__, __dir__ = lazy.attach(1126 __name__,1127 ['mysubmodule', 'anothersubmodule'],1128 {'foo': ['someattr']}1129 )1130 ```1131 This functionality requires Python 3.7 or higher.1132 1133 Args:1134 package_name (`str`):1135 Typically use `__name__`.1136 submodules (`set`):1137 List of submodules to attach.1138 submod_attrs (`dict`):1139 Dictionary of submodule -> list of attributes / functions.1140 These attributes are imported as they are used.1141 1142 Returns:1143 __getattr__, __dir__, __all__1144 1145 """1146 if submod_attrs is None:1147 submod_attrs = {}1148 1149 if submodules is None:1150 submodules = set()1151 else:1152 submodules = set(submodules)1153 1154 attr_to_modules = {attr: mod for mod, attrs in submod_attrs.items() for attr in attrs}1155 1156 def __getattr__(name):1157 if name in submodules:1158 try:1159 return importlib.import_module(f"{package_name}.{name}")1160 except Exception as e:1161 print(f"Error importing {package_name}.{name}: {e}")1162 raise1163 elif name in attr_to_modules:1164 submod_path = f"{package_name}.{attr_to_modules[name]}"1165 try:1166 submod = importlib.import_module(submod_path)1167 except Exception as e:1168 print(f"Error importing {submod_path}: {e}")1169 raise1170 attr = getattr(submod, name)1171 1172 # If the attribute lives in a file (module) with the same1173 # name as the attribute, ensure that the attribute and *not*1174 # the module is accessible on the package.1175 if name == attr_to_modules[name]:1176 pkg = sys.modules[package_name]1177 pkg.__dict__[name] = attr1178 1179 return attr1180 else:1181 raise AttributeError(f"No {package_name} attribute {name}")1182 1183 def __dir__():1184 return __all__1185 1186 return __getattr__, __dir__1187 1188 1189__getattr__, __dir__ = _attach(__name__, submodules=[], submod_attrs=_SUBMOD_ATTRS)1190 1191if os.environ.get("EAGER_IMPORT", ""):1192 for attr in __all__:1193 __getattr__(attr)1194 1195# WARNING: any content below this statement is generated automatically. Any manual edit1196# will be lost when re-generating this file !1197#1198# To update the static imports, please run the following command and commit the changes.1199# ```1200# # Use script