install_pdx.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
  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 os
  15. import argparse
  16. from paddlex.repo_manager import setup, get_all_supported_repo_names
  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. args = parser.parse_args()
  34. repo_names = args.devkits
  35. if len(repo_names) == 0:
  36. repo_names = get_all_supported_repo_names()
  37. setup(
  38. repo_names=repo_names,
  39. reinstall=args.reinstall or None,
  40. no_deps=args.no_deps,
  41. platform=args.platform,
  42. update_repos=args.update_repos)