Voice et bot modif
This commit is contained in:
parent
189d56026b
commit
7333a22bcd
10774 changed files with 634644 additions and 933308 deletions
|
|
@ -12,56 +12,118 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
import traceback
|
||||
from typing import Annotated
|
||||
|
||||
from huggingface_hub import constants
|
||||
from huggingface_hub.cli._cli_utils import check_cli_update, typer_factory
|
||||
import typer
|
||||
|
||||
from huggingface_hub import __version__, constants
|
||||
from huggingface_hub.cli._cli_utils import check_cli_update, fallback_typer_group_factory, typer_factory
|
||||
from huggingface_hub.cli._cp import CP_EXAMPLES, make_cp
|
||||
from huggingface_hub.cli._errors import format_known_exception
|
||||
from huggingface_hub.cli.auth import auth_cli
|
||||
from huggingface_hub.cli.buckets import buckets_cli, sync
|
||||
from huggingface_hub.cli.cache import cache_cli
|
||||
from huggingface_hub.cli.collections import collections_cli
|
||||
from huggingface_hub.cli.datasets import datasets_cli
|
||||
from huggingface_hub.cli.download import download
|
||||
from huggingface_hub.cli.discussions import discussions_cli
|
||||
from huggingface_hub.cli.download import DOWNLOAD_EXAMPLES, download
|
||||
from huggingface_hub.cli.extensions import (
|
||||
dispatch_unknown_top_level_extension,
|
||||
extensions_cli,
|
||||
list_installed_extensions_for_help,
|
||||
)
|
||||
from huggingface_hub.cli.inference_endpoints import ie_cli
|
||||
from huggingface_hub.cli.jobs import jobs_cli
|
||||
from huggingface_hub.cli.lfs import lfs_enable_largefiles, lfs_multipart_upload
|
||||
from huggingface_hub.cli.models import models_cli
|
||||
from huggingface_hub.cli.repo import repo_cli
|
||||
from huggingface_hub.cli.papers import papers_cli
|
||||
from huggingface_hub.cli.repo_files import repo_files_cli
|
||||
from huggingface_hub.cli.repos import repos_cli
|
||||
from huggingface_hub.cli.skills import skills_cli
|
||||
from huggingface_hub.cli.spaces import spaces_cli
|
||||
from huggingface_hub.cli.system import env, version
|
||||
from huggingface_hub.cli.upload import upload
|
||||
from huggingface_hub.cli.upload_large_folder import upload_large_folder
|
||||
from huggingface_hub.utils import logging
|
||||
from huggingface_hub.cli.system import env, update, version
|
||||
from huggingface_hub.cli.upload import UPLOAD_EXAMPLES, upload
|
||||
from huggingface_hub.cli.upload_large_folder import UPLOAD_LARGE_FOLDER_EXAMPLES, upload_large_folder
|
||||
from huggingface_hub.cli.webhooks import webhooks_cli
|
||||
from huggingface_hub.utils import ANSI, logging
|
||||
|
||||
|
||||
app = typer_factory(help="Hugging Face Hub CLI")
|
||||
app = typer_factory(
|
||||
help="Hugging Face Hub CLI",
|
||||
cls=fallback_typer_group_factory(
|
||||
dispatch_unknown_top_level_extension,
|
||||
extra_commands_provider=list_installed_extensions_for_help,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def _version_callback(value: bool) -> None:
|
||||
if value:
|
||||
print(__version__)
|
||||
raise typer.Exit()
|
||||
|
||||
|
||||
@app.callback(invoke_without_command=True)
|
||||
def app_callback(
|
||||
version: Annotated[
|
||||
bool | None, typer.Option("-v", "--version", callback=_version_callback, is_eager=True, hidden=True)
|
||||
] = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
|
||||
# top level single commands (defined in their respective files)
|
||||
app.command(help="Download files from the Hub.")(download)
|
||||
app.command(help="Upload a file or a folder to the Hub.")(upload)
|
||||
app.command(help="Upload a large folder to the Hub. Recommended for resumable uploads.")(upload_large_folder)
|
||||
app.command(name="env", help="Print information about the environment.")(env)
|
||||
app.command(help="Print information about the hf version.")(version)
|
||||
app.command(help="Configure your repository to enable upload of files > 5GB.", hidden=True)(lfs_enable_largefiles)
|
||||
app.command(help="Upload large files to the Hub.", hidden=True)(lfs_multipart_upload)
|
||||
app.command(examples=CP_EXAMPLES)(make_cp())
|
||||
app.command()(sync)
|
||||
app.command(examples=DOWNLOAD_EXAMPLES)(download)
|
||||
app.command(examples=UPLOAD_EXAMPLES)(upload)
|
||||
app.command(examples=UPLOAD_LARGE_FOLDER_EXAMPLES)(upload_large_folder)
|
||||
|
||||
app.command(topic="help")(env)
|
||||
app.command(topic="help")(update)
|
||||
app.command(topic="help")(version)
|
||||
|
||||
app.command(hidden=True)(lfs_enable_largefiles)
|
||||
app.command(hidden=True)(lfs_multipart_upload)
|
||||
|
||||
# command groups
|
||||
app.add_typer(auth_cli, name="auth")
|
||||
app.add_typer(buckets_cli, name="buckets")
|
||||
app.add_typer(cache_cli, name="cache")
|
||||
app.add_typer(collections_cli, name="collections")
|
||||
app.add_typer(datasets_cli, name="datasets")
|
||||
app.add_typer(discussions_cli, name="discussions")
|
||||
app.add_typer(jobs_cli, name="jobs")
|
||||
app.add_typer(models_cli, name="models")
|
||||
app.add_typer(repo_cli, name="repo")
|
||||
app.add_typer(repo_files_cli, name="repo-files")
|
||||
app.add_typer(papers_cli, name="papers")
|
||||
app.add_typer(repos_cli, name="repos | repo")
|
||||
app.add_typer(repo_files_cli, name="repo-files", hidden=True)
|
||||
app.add_typer(skills_cli, name="skills")
|
||||
app.add_typer(spaces_cli, name="spaces")
|
||||
app.add_typer(webhooks_cli, name="webhooks")
|
||||
app.add_typer(ie_cli, name="endpoints")
|
||||
app.add_typer(extensions_cli, name="extensions | ext")
|
||||
|
||||
|
||||
def main():
|
||||
if not constants.HF_DEBUG:
|
||||
logging.set_verbosity_info()
|
||||
check_cli_update("huggingface_hub")
|
||||
app()
|
||||
|
||||
try:
|
||||
app()
|
||||
except Exception as e:
|
||||
message = format_known_exception(e)
|
||||
if message:
|
||||
print(f"Error: {message}", file=sys.stderr)
|
||||
if constants.HF_DEBUG:
|
||||
traceback.print_exc()
|
||||
else:
|
||||
print(ANSI.gray("Set HF_DEBUG=1 as environment variable for full traceback."))
|
||||
sys.exit(1)
|
||||
raise
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue