install_pdx.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright (c) 2024 PaddlePaddle Authors. 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. import argparse
  15. import os
  16. from paddlex.repo_manager import get_all_supported_repo_names, setup
  17. if __name__ == "__main__":
  18. # Enable debug info
  19. os.environ["PADDLE_PDX_DEBUG"] = "True"
  20. # Disable eager initialization
  21. os.environ["PADDLE_PDX_EAGER_INIT"] = "False"
  22. parser = argparse.ArgumentParser()
  23. parser.add_argument("devkits", nargs="*", default=[])
  24. parser.add_argument("--no_deps", action="store_true")
  25. parser.add_argument("--platform", type=str, default="github.com")
  26. parser.add_argument("--update_repos", action="store_true")
  27. parser.add_argument(
  28. "-y",
  29. "--yes",
  30. dest="reinstall",
  31. action="store_true",
  32. help="Whether to reinstall all packages.",
  33. )
  34. args = parser.parse_args()
  35. repo_names = args.devkits
  36. if len(repo_names) == 0:
  37. repo_names = get_all_supported_repo_names()
  38. setup(
  39. repo_names=repo_names,
  40. reinstall=args.reinstall or None,
  41. no_deps=args.no_deps,
  42. platform=args.platform,
  43. update_repos=args.update_repos,
  44. )