File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:164, in AstScanning.scan_import(self, node, show_offsets, parent_node_name)
163 for el in attr:
--> 164 local_out = _scan_import(el, type(el).name)
165 name = type(el).name
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:151, in AstScanning.scan_import(self, node, show_offsets, parent_node_name)
150 for field in self._fields(node, show_offsets=show_offsets):
--> 151 attr = getattr(node, field)
152 if attr == []:
AttributeError: 'ClassDef' object has no attribute 'type_params'
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
Cell In[5], line 2
1 import torch
----> 2 from modelscope import snapshot_download, AutoModel, AutoTokenizer
3 import os
4 model_dir = snapshot_download('LLM-Research/Meta-Llama-3.1-8B-Instruct', cache_dir='/root/autodl-tmp', revision='master')
File ~/miniconda3/lib/python3.10/site-packages/modelscope/init.py:4
1 # Copyright (c) Alibaba, Inc. and its affiliates.
2 from typing import TYPE_CHECKING
----> 4 from modelscope.utils.import_utils import (LazyImportModule,
5 is_transformers_available)
6 from .utils.automodel_utils import fix_transformers_upgrade
8 if TYPE_CHECKING:
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/import_utils.py:380
375 raise ImportError(f'Method {func.name} requires TF.')
377 return wrapper
--> 380 class LazyImportModule(ModuleType):
381 AST_INDEX = None
382 if AST_INDEX is None:
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:722, in load_index(file_list, force_rebuild, indexer_file_dir, indexer_file)
717 elif local_changed and not full_index_flag:
718 logger.info(
719 'Updating the files for the changes of local files, '
720 'first time updating will take longer time! Please wait till updating done!'
721 )
--> 722 _update_index(index, files_mtime)
723 _save_index(index, file_path, file_list)
725 logger.info(
726 f'Loading done! Current index file version is {index[VERSION_KEY]}, '
727 f'with md5 {index[MD5_KEY]} and a total number of '
728 f'{len(index[INDEX_KEY])} components indexed')
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:638, in _update_index(index, files_mtime)
635 del index[REQUIREMENT_KEY][key]
637 # add new index
--> 638 updated_index = file_scanner.get_files_scan_results(updated_files)
639 index[INDEX_KEY].update(updated_index[INDEX_KEY])
640 index[REQUIREMENT_KEY].update(updated_index[REQUIREMENT_KEY])
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:469, in FilesAstScanning._get_single_file_scan_result(self, file)
467 except Exception as e:
468 detail = traceback.extract_tb(e.traceback)
--> 469 raise Exception(
470 f'During ast indexing the file {file}, a related error excepted '
471 f'in the file {detail[-1].filename} at line: '
472 f'{detail[-1].lineno}: "{detail[-1].line}" with error msg: '
473 f'"{type(e).name}: {e}", please double check the origin file {file} '
474 f'to see whether the file is correctly edited.')
476 import_list = self.parse_import(output)
477 return output[DECORATOR_KEY], import_list
Exception: During ast indexing the file /root/miniconda3/lib/python3.10/site-packages/modelscope/models/audio/aec/layers/activations.py, a related error excepted in the file /root/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py at line: 151: "path_level = ''.join(['.'] * level)" with error msg: "AttributeError: 'ClassDef' object has no attribute 'type_params'", please double check the origin file /root/miniconda3/lib/python3.10/site-packages/modelscope/models/audio/aec/layers/activations.py to see whether the file is correctly edited.
https://github.com/datawhalechina/self-llm/blob/master/models/Llama3_1/04-Llama3_1-8B--Instruct%20Lora%20%E5%BE%AE%E8%B0%83.md 使用上述教程中提到的AutoDL中的镜像,报错: import torch from modelscope import snapshot_download, AutoModel, AutoTokenizer import os model_dir = snapshot_download('LLM-Research/Meta-Llama-3.1-8B-Instruct', cache_dir='/root/autodl-tmp', revision='master') 报错如下:--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:466, in FilesAstScanning._get_single_file_scan_result(self, file) 465 try: --> 466 output = self.astScaner.generate_ast(file) 467 except Exception as e:
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:365, in AstScanning.generate_ast(self, file) 364 node = gast.parse(data) --> 365 output = self.scan_import(node, show_offsets=False) 366 output[DECORATOR_KEY] = self.parse_decorators(output[DECORATOR_KEY])
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:164, in AstScanning.scan_import(self, node, show_offsets, parent_node_name) 163 for el in attr: --> 164 local_out = _scan_import(el, type(el).name) 165 name = type(el).name
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:133, in AstScanning.scan_import.._scan_import(el, parent_node_name) 131 def _scan_import(el: Union[ast.AST, None, str], 132 parent_node_name: str = '') -> str: --> 133 return self.scan_import( 134 el, 135 show_offsets=show_offsets, 136 parent_node_name=parent_node_name)
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:151, in AstScanning.scan_import(self, node, show_offsets, parent_node_name) 150 for field in self._fields(node, show_offsets=show_offsets): --> 151 attr = getattr(node, field) 152 if attr == []:
AttributeError: 'ClassDef' object has no attribute 'type_params'
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last) Cell In[5], line 2 1 import torch ----> 2 from modelscope import snapshot_download, AutoModel, AutoTokenizer 3 import os 4 model_dir = snapshot_download('LLM-Research/Meta-Llama-3.1-8B-Instruct', cache_dir='/root/autodl-tmp', revision='master')
File ~/miniconda3/lib/python3.10/site-packages/modelscope/init.py:4 1 # Copyright (c) Alibaba, Inc. and its affiliates. 2 from typing import TYPE_CHECKING ----> 4 from modelscope.utils.import_utils import (LazyImportModule, 5 is_transformers_available) 6 from .utils.automodel_utils import fix_transformers_upgrade 8 if TYPE_CHECKING:
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/import_utils.py:380 375 raise ImportError(f'Method {func.name} requires TF.') 377 return wrapper --> 380 class LazyImportModule(ModuleType): 381 AST_INDEX = None 382 if AST_INDEX is None:
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/import_utils.py:383, in LazyImportModule() 381 AST_INDEX = None 382 if AST_INDEX is None: --> 383 AST_INDEX = load_index() 385 def init(self, 386 name, 387 module_file, (...) 390 extra_objects=None, 391 try_to_pre_import=False): 392 super().init(name)
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:722, in load_index(file_list, force_rebuild, indexer_file_dir, indexer_file) 717 elif local_changed and not full_index_flag: 718 logger.info( 719 'Updating the files for the changes of local files, ' 720 'first time updating will take longer time! Please wait till updating done!' 721 ) --> 722 _update_index(index, files_mtime) 723 _save_index(index, file_path, file_list) 725 logger.info( 726 f'Loading done! Current index file version is {index[VERSION_KEY]}, ' 727 f'with md5 {index[MD5_KEY]} and a total number of ' 728 f'{len(index[INDEX_KEY])} components indexed')
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:638, in _update_index(index, files_mtime) 635 del index[REQUIREMENT_KEY][key] 637 # add new index --> 638 updated_index = file_scanner.get_files_scan_results(updated_files) 639 index[INDEX_KEY].update(updated_index[INDEX_KEY]) 640 index[REQUIREMENT_KEY].update(updated_index[REQUIREMENT_KEY])
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:532, in FilesAstScanning.get_files_scan_results(self, target_file_list, target_dir, target_folders) 530 filepath = file[file.rfind('modelscope'):] 531 module_name = filepath.replace(osp.sep, '.').replace('.py', '') --> 532 decorator_list, import_list = self._get_single_file_scan_result( 533 file) 534 result[file] = { 535 DECORATOR_KEY: decorator_list, 536 IMPORT_KEY: import_list, 537 MODULE_KEY: module_name 538 } 539 inverted_index_with_results = self._inverted_index(result)
File ~/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py:469, in FilesAstScanning._get_single_file_scan_result(self, file) 467 except Exception as e: 468 detail = traceback.extract_tb(e.traceback) --> 469 raise Exception( 470 f'During ast indexing the file {file}, a related error excepted ' 471 f'in the file {detail[-1].filename} at line: ' 472 f'{detail[-1].lineno}: "{detail[-1].line}" with error msg: ' 473 f'"{type(e).name}: {e}", please double check the origin file {file} ' 474 f'to see whether the file is correctly edited.') 476 import_list = self.parse_import(output) 477 return output[DECORATOR_KEY], import_list
Exception: During ast indexing the file /root/miniconda3/lib/python3.10/site-packages/modelscope/models/audio/aec/layers/activations.py, a related error excepted in the file /root/miniconda3/lib/python3.10/site-packages/modelscope/utils/ast_utils.py at line: 151: "path_level = ''.join(['.'] * level)" with error msg: "AttributeError: 'ClassDef' object has no attribute 'type_params'", please double check the origin file /root/miniconda3/lib/python3.10/site-packages/modelscope/models/audio/aec/layers/activations.py to see whether the file is correctly edited.