mirror of
https://github.com/modelscope/modelscope.git
synced 2026-07-10 20:39:53 +02:00
* add self-hosted repo: * add extra requirements for different field and reduce necessary requirements * update docker file with so required by audio * add requirements checker which will be used later when implement lazy import * remove repeated requirements and replace opencv-python-headless with opencv-python example usage: ```shell pip install model_scope[all] -f https://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/release/maas/repo.html pip install model_scope[cv] -f https://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/release/maas/repo.html pip install model_scope[nlp] -f https://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/release/maas/repo.html pip install model_scope[audio] -f https://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/release/maas/repo.html pip install model_scope[multi-modal] -f https://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/release/maas/repo.html ``` Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/9211383
23 lines
636 B
Python
23 lines
636 B
Python
# Copyright (c) Alibaba, Inc. and its affiliates.
|
|
|
|
import unittest
|
|
from typing import List, Union
|
|
|
|
from modelscope.utils.check_requirements import NLPModuleNotFoundError, get_msg
|
|
from modelscope.utils.constant import Fields
|
|
|
|
|
|
class ImportUtilsTest(unittest.TestCase):
|
|
|
|
def test_type_module_not_found(self):
|
|
with self.assertRaises(NLPModuleNotFoundError) as ctx:
|
|
try:
|
|
import not_found
|
|
except ModuleNotFoundError as e:
|
|
raise NLPModuleNotFoundError(e)
|
|
self.assertTrue(get_msg(Fields.nlp) in ctx.exception.msg.msg)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|