IsakZhang/ABSA-QUAD

An error occurs when loading a previously trained model from 'do_direct_eval()' for evaluation.

dev-hjJoo opened this issue · 1 comments

Hello, thanks for sharing your code.

Currently, model training has been performed through the 'do_train()' code, and the trained model has been saved. After that, I uncommented the commented part to load the trained model for inference, but an error occurred. The content of the error is as follows.

****** Conduct Evaluating with the last state ******
Traceback (most recent call last):
File "myPath\ABSA-QUAD\main.py", line 312, in
model = T5FineTuner(args)
TypeError: init() missing 2 required positional arguments: 'tfm_model' and 'tokenizer'

Please let me know how to solve this.

I solved this problem. I will write the solution below and request a pull requests.

main.py line309
[Before]

model = T5FineTuner(args)

print("Reload the model")
model.model.from_pretrained(args.output_dir)

[After]

tfm_model = T5ForConditionalGeneration.from_pretrained(args.model_name_or_path)
model = T5FineTuner(args , tfm_model, tokenizer)

print("Reload the model")
model.model.from_pretrained('saved_model')