transformers.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright 2025 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 at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # 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 and
  13. # limitations under the License.
  14. """Transformers CLI."""
  15. from huggingface_hub import check_cli_update, typer_factory
  16. from transformers.cli.add_new_model_like import add_new_model_like
  17. from transformers.cli.chat import Chat
  18. from transformers.cli.download import download
  19. from transformers.cli.serve import Serve
  20. from transformers.cli.system import env, version
  21. app = typer_factory(help="Transformers CLI")
  22. app.command()(add_new_model_like)
  23. app.command(name="chat")(Chat)
  24. app.command()(download)
  25. app.command()(env)
  26. app.command(name="serve")(Serve)
  27. app.command()(version)
  28. def main():
  29. check_cli_update("transformers")
  30. app()
  31. if __name__ == "__main__":
  32. main()