ProsusAI / finBERT

Financial Sentiment Analysis with BERT
Apache License 2.0
1.42k stars 413 forks source link

TypeError: unsupported operand type(s) for /: 'str' and 'str' at trained_model = finbert.train(train_examples = train_data, model = model) #29

Closed nithinreddyy closed 3 years ago

nithinreddyy commented 3 years ago

I'm facing an issue at code

trained_model = finbert.train(train_examples = train_data, model = model)

Error is

TypeError                                 Traceback (most recent call last)
<ipython-input-11-2ebf0cb3d4e8> in <module>
----> 1 trained_model = finbert.train(train_examples = train_data, model = model)

~\finBERT-master\finbert\finbert.py in train(self, train_examples, model)
    482                     print('No best model found')
    483                 torch.save({'epoch': str(i), 'state_dict': model.state_dict()},
--> 484                            self.config.model_dir / ('temporary' + str(i)))
    485                 best_model = i
    486 

TypeError: unsupported operand type(s) for /: 'str' and 'str'
doguaraci commented 3 years ago

self.config.model_dir should have PosixPath class. Could you please check if that is the case?

luke4u commented 2 years ago

Hi @doguaraci @nithinreddyy , just checking if this is resolved properly? I am facing the same issue!

Thank you!

luke4u commented 2 years ago

for anyone who is interested, try this: cl_path = pathlib.Path(project_dir)/'resources'/'models'/'classifier_model'/'finbert-sentiment'