[to #43115513] fix module path error for ast and add numpy<=1.18

1. fix module path error,   if code path contains multiple `modelscope` str,  use the last one as the start position of  modelscope source direcotry
2. add numpy version constraint <=1.18
3. add __init__.py to models/cv/image_to_image_translation
4. split audio requirements from all

 Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/9587929
This commit is contained in:
wenmeng.zwm
2022-08-01 15:42:58 +08:00
parent 9471f0a9a7
commit 34acc596e1
4 changed files with 8 additions and 4 deletions

View File

@@ -490,7 +490,7 @@ class FilesAstScaning(object):
result = dict()
for file in self.file_dirs:
filepath = file[file.find('modelscope'):]
filepath = file[file.rfind('modelscope'):]
module_name = filepath.replace(osp.sep, '.').replace('.py', '')
decorator_list, import_list = self._get_single_file_scan_result(
file)

View File

@@ -11,8 +11,8 @@ matplotlib
MinDAEC
nara_wpe
nltk
# numpy requirements should be declared with tensorflow 1.15 but not here
# numpy<=1.18
# tensorflow 1.15 requires numpy<=1.18
numpy<=1.18
# protobuf version beyond 3.20.0 is not compatible with TensorFlow 1.x, therefore is discouraged.
protobuf>3,<3.21.0
ptflops

View File

@@ -178,7 +178,11 @@ if __name__ == '__main__':
continue
extra_requires[field], _ = parse_requirements(
f'requirements/{field}.txt')
all_requires.extend(extra_requires[field])
# skip audio requirements due to its hard dependency which
# result in mac/windows compatibility problems
if field != Fields.audio:
all_requires.append(extra_requires[field])
extra_requires['all'] = all_requires