-
-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infer from code (args.pkl) #35
Comments
Hi I also faced same problem, when infer from code,
|
I solved this issue. Actually the problem was , we trying to predict the relation to the given sentence in outside main_task.py Inside main_task.py, you will add these lines, it works fine and it's not throws error. inferer = infer_from_trained(args, detect_entities=True) Because, in main_task.py script, have the args values. Therefore, it threw error, when you tried to run the code outside main_task.py If you want to predict the relation for the given sentence outside main_task.py, you will add the the following lines into the man_task.py script. then you will run the main_task.py script with arguments which you want and then you will execute the predicting the relation scripts and give "args=None" kindly make sure that you import all the packages in the main_task.py |
Hi, Could you please tell me where exactly I need to insert: I've tried running this code outside main_task.py on a separate jupyter notebook: I'm getting this error:AttributeError Traceback (most recent call last) File ~\Documents\Work\Uni\ARU\Thesis\Experiment\BERT-Relation-Extraction\src\tasks\infer.py:53, in infer_from_trained.init(self, args, detect_entities) AttributeError: 'Relations_Mapper' object has no attribute 'model_no' I'm also trying to run a fine-tuned model insteading of pre-training the whole model with cnn.txt so not sure if that's causing the error? |
You can write it after Note: I had to write |
self.rm = load_pickle("relations.pkl") in infer.py is also missing. Where to get this from? |
HI, I have problem when infering from code
It throws error that args is not defined, can u help me with which values to fill args. If I put None it needs the args.pkl, but I cannot find the pickle after the training for semeval task.
The text was updated successfully, but these errors were encountered: