PyABSA Version 2 not working- RuntimeError: Exception: expected str, bytes or os.PathLike object, not NoneType Fail to load the model from multilingual! #403
Labels
bug
Something isn't working
Version
PyABSA version 2.4.1.post1
Describe the bug
I have installed PyABSA and tried to run the examples, but I keep getting the error that the Runtime wrror that the model has failed to load. I have tried version 1, and this works, but none of the version 2 packages have worked. How do I go about solving this?
Code To Reproduce
pip install -U pyabsa
from pyabsa import AspectTermExtraction as ATEPC, available_checkpoints
you can view all available checkpoints by calling available_checkpoints()
checkpoint_map = available_checkpoints()
aspect_extractor = ATEPC.AspectExtractor('multilingual',
auto_device=True, # False means load model on CPU
cal_perplexity=True,
)
instance inference
aspect_extractor.predict(['I love this movie, it is so great!'],
save_result=True,
print_result=True, # print the result
ignore_error=True, # ignore the error when the model cannot predict the input
)
inference_source = ATEPC.ATEPCDatasetList.Restaurant16
atepc_result = aspect_extractor.batch_predict(target_file=inference_source, #
save_result=True,
print_result=True, # print the result
pred_sentiment=True, # Predict the sentiment of extracted aspect terms
)
print(atepc_result)
Expected behavior
This was expected to run and provide the sentiment classifications, but when run, the execution always fails with this error:
RuntimeError: Exception: expected str, bytes or os.PathLike object, not NoneType Fail to load the model from multilingual!
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-b49d82e8-1a51-4577-a57e-bdaccd63c848/lib/python3.10/site-packages/pyabsa/tasks/AspectTermExtraction/prediction/aspect_extractor.py:82, in AspectExtractor.init(self, checkpoint, **kwargs)
80 fprint("tokenizer: {}".format(tokenizer_path))
---> 82 with open(config_path, mode="rb") as f:
83 self.config = pickle.load(f)
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-b49d82e8-1a51-4577-a57e-bdaccd63c848/lib/python3.10/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 )
I have tried a number of things, including downloading the checkpoint, but I'm now not sure how to get this to work.
The text was updated successfully, but these errors were encountered: