honghanhh / ner-combining-contextual-and-global-features

[ICADL] Named entity recognition architecture combining contextual and global features
12 stars 3 forks source link

predict.py #8

Open samanthatansy opened 2 years ago

samanthatansy commented 2 years ago

Hi, I am trying to only use xlnet model without the gcn for NER. I have ran train.py in the 'xlnet-ner' folder and obtained the saved weights - '4.pt' in a finetuning folder. However, I have issues with the predict.py file. When I try to run it, I get the following error: image

I then fixed it by added 'import torch.nn as nn'. However, after that, i get the following error: image

I am using the same codes, but had only removed .cuda() as I am only using 'cpu' image

I am not sure what is wrong, please help thank you!

honghanhh commented 2 years ago

Hi @samanthatansy, Make sare that you have already import torch.nn import torch.nn as nn Maybe you mistook deleting that line.

samanthatansy commented 2 years ago

hi i imported torch.nn, but even if i do not delete that line (.cuda) and use GPU (using the same codes as provided exactly), i still get the same error. Also may I check, must I write anything in the command line arguments? (is it something compulsory to fill?) if yes then what does '--finetuning' and '--top_rnns' mean? thanks! image