You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

util.py 817 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (c) Alibaba, Inc. and its affiliates.
  2. import os.path as osp
  3. import json
  4. from maas_hub.file_download import model_file_download
  5. from maas_lib.utils.constant import CONFIGFILE
  6. def is_model_name(model):
  7. if osp.exists(model):
  8. if osp.exists(osp.join(model, CONFIGFILE)):
  9. return True
  10. else:
  11. return False
  12. else:
  13. # try:
  14. # cfg_file = model_file_download(model, CONFIGFILE)
  15. # except Exception:
  16. # cfg_file = None
  17. # TODO @wenmeng.zwm use exception instead of
  18. # following tricky logic
  19. cfg_file = model_file_download(model, CONFIGFILE)
  20. with open(cfg_file, 'r') as infile:
  21. cfg = json.load(infile)
  22. if 'Code' in cfg:
  23. return False
  24. else:
  25. return True

致力于通过开放的社区合作,开源AI模型以及相关创新技术,推动基于模型即服务的生态繁荣发展