Open sqs17 opened 4 months ago
You are loading a outdated checkpoint, I will check the error later
Ok, thank you very much!
BTW, you can try multilingual checkpoint which should be fine
I try to use multilingual checkpoint ,but it still be wrong--"ModuleNotFoundError: No module named 'pyabsa.functional'"
Version See the console output for PyABSA, Torch, Transformers Version pyabsa=2.3.4, torch=2.2.0,transformer=4.29.0
Describe the bug Hello, I tried to use a pre-trained model on jupyter, I put the pre-trained model in.ipynb_checkpoints files, but there were runtime error, thank you for your answers.
Code To Reproduce from pyabsa import ABSADatasetList, available_checkpoints from pyabsa import ATEPCCheckpointManager aspect_extractor = ATEPCCheckpointManager.get_aspect_extractor(checkpoint='Chinese', auto_device=False # False means load model on CPU )
[2024-02-17 09:55:41] (2.3.4) Fail to download checkpoints info from huggingface space, try to download from local [2024-02-17 09:55:41] (2.3.4) No checkpoint found in Model Hub for task: Chinese [2024-02-17 09:55:41] (2.3.4) Load aspect extractor from .ipynb_checkpoints\fast_lcf_atepc_Chinese_cdw_apcacc_96.09_apcf1_95.14_atef1_83.69 [2024-02-17 09:55:41] (2.3.4) config: .ipynb_checkpoints\fast_lcf_atepc_Chinese_cdw_apcacc_96.09_apcf1_95.14_atef1_83.69\fast_lcf_atepc.config [2024-02-17 09:55:41] (2.3.4) state_dict: .ipynb_checkpoints\fast_lcf_atepc_Chinese_cdw_apcacc_96.09_apcf1_95.14_atef1_83.69\fast_lcf_atepc.state_dict [2024-02-17 09:55:41] (2.3.4) model: None [2024-02-17 09:55:41] (2.3.4) tokenizer: .ipynb_checkpoints\fast_lcf_atepc_Chinese_cdw_apcacc_96.09_apcf1_95.14_atef1_83.69\fast_lcf_atepc.tokenizer
ModuleNotFoundError Traceback (most recent call last) File D:\anaconda\envs\absa\Lib\site-packages\pyabsa\tasks\AspectTermExtraction\prediction\aspect_extractor.py:83, in AspectExtractor.init(self, checkpoint, **kwargs) 82 with open(config_path, mode="rb") as f: ---> 83 self.config = pickle.load(f) 84 self.config.auto_device = kwargs.get("auto_device", True)
ModuleNotFoundError: No module named 'pyabsa.functional'
During handling of the above exception, another exception occurred:
RuntimeError Traceback (most recent call last) Cell In[2], line 1 ----> 1 aspect_extractor = ATEPCCheckpointManager.get_aspect_extractor(checkpoint='Chinese', 2 auto_device=False # False means load model on CPU 3 )
File D:\anaconda\envs\absa\Lib\site-packages\pyabsa\framework\checkpoint_class\checkpoint_template.py:223, in ATEPCCheckpointManager.get_aspect_extractor(checkpoint, kwargs) 210 @staticmethod 211 def get_aspect_extractor( 212 checkpoint: Union[str, Path] = None, kwargs 213 ) -> "AspectExtractor": 214 """ 215 Get an AspectExtractor object initialized with the given checkpoint for Aspect Term Extraction and Polarity Classification. 216 (...) 220 :return: An AspectExtractor object initialized with the given checkpoint. 221 """ --> 223 return AspectExtractor( 224 CheckpointManager().parse_checkpoint( 225 checkpoint, TaskCodeOption.Aspect_Term_Extraction_and_Classification 226 ) 227 )
File D:\anaconda\envs\absa\Lib\site-packages\pyabsa\tasks\AspectTermExtraction\prediction\aspect_extractor.py:131, in AspectExtractor.init(self, checkpoint, **kwargs) 128 self.tokenizer = pickle.load(f) 130 except Exception as e: --> 131 raise RuntimeError( 132 "Exception: {} Fail to load the model from {}! ".format( 133 e, self.checkpoint 134 ) 135 ) 137 if not hasattr(ATEPCModelList, self.model.class.name): 138 raise KeyError( 139 "The checkpoint you are loading is not from any ATEPC model." 140 )
RuntimeError: Exception: No module named 'pyabsa.functional' Fail to load the model from .ipynb_checkpoints\fast_lcf_atepc_Chinese_cdw_apcacc_96.09_apcf1_95.14_atef1_83.69!