Traceback (most recent call last): | 0/949 [00:00<?, ?it/s]
File "train_bert.py", line 105, in <module>
main()
File "train_bert.py", line 95, in main
model.train_model(train_df=df_train)
File "/opt/conda/lib/python3.6/site-packages/simpletransformers/classification/classification_model.py", line 219, in train_model
global_step, tr_loss = self.train(train_dataset, output_dir, multi_label=multi_label, show_running_loss=show_running_loss, eval_df=eval_df, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/simpletransformers/classification/classification_model.py", line 330, in train
logger.info("\rRunning loss: %f\n" % loss, end="")
File "/opt/conda/lib/python3.6/logging/__init__.py", line 1307, in info
self._log(INFO, msg, args, **kwargs)
TypeError: _log() got an unexpected keyword argument 'end'
Looks like switching from print to logging is causing this issue
+1
Yeah same here. I'm trying to get the training logs back but no luck.
It happens when doing import logging for me. If I reload everything without this, I can train but no log at all.
Current solution is to install the old version pip install simpletransformers==0.16.1
I changed it back to prints as logging was weirding out on me as well. I'll look into this.
Can we please follow best practices?
see: https://docs.python.org/3/howto/logging.html#library-config
logging.info()... is bad form, not recommended, should actually declare a Logger instance.
Also the error is:
logger.info("\rRunning loss: %f\n" % loss, end="")
@kinoute
This is a library, if folks want info from it, they should initialize a logger:
import logging
logging.basicConfig(level=logging.DEBUG)
@todd-cook That's what I was doing after the PR with logging was merged. The library wasn't working correctly afterwards. Give it some time and I'm sure @ThilinaRajapakse will implement it nicely.
@ThilinaRajapakse let me know if you want me to take a stab at this.
It's fine, I'll look into it. Thanks guys.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
@ThilinaRajapakse let me know if you want me to take a stab at this.