question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: 'NoneType' object has no attribute 'log_metric'

See original GitHub issue

I have no idea about the following error, looking forward to someone’s help, thank you! ~~

Traceback (most recent call last):
  File "disfluency_detection/pipelines/sentseg_train.py", line 427, in <module>
    main()
  File "disfluency_detection/pipelines/sentseg_train.py", line 394, in main
    metrics = trainer.evaluate()
  File "/home/xxx/anaconda3/envs/correction/lib/python3.7/site-packages/transformers/trainer.py", line 2044, in evaluate
    self.log(output.metrics)
  File "/home/xxx/anaconda3/envs/correction/lib/python3.7/site-packages/transformers/trainer.py", line 1709, in log
    self.control = self.callback_handler.on_log(self.args, self.state, self.control, logs)
  File "/home/xxx/anaconda3/envs/correction/lib/python3.7/site-packages/transformers/trainer_callback.py", line 371, in on_log
    return self.call_event("on_log", args, state, control, logs=logs)
  File "/home/xxx/anaconda3/envs/correction/lib/python3.7/site-packages/transformers/trainer_callback.py", line 388, in call_event
    **kwargs,
  File "/home/xxx/anaconda3/envs/correction/lib/python3.7/site-packages/transformers/integrations.py", line 354, in on_log
    self.tb_writer.add_scalar(k, v, state.global_step)
  File "/home/xxx/anaconda3/envs/correction/lib/python3.7/site-packages/tensorboardX/writer.py", line 453, in add_scalar
    self.comet_logger.log_metric(tag, display_name, scalar_value, global_step)
AttributeError: 'NoneType' object has no attribute 'log_metric'

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
grafarawaycommented, Oct 13, 2021

I used with summary_writer:summary_writer.add_graph( ) before .add_scalar( ) After deleting with summary_writer: , my code could get correct output.

0reactions
lanpacommented, Nov 16, 2021

@DrraBL Can you try whether pip install git+https://github.com/lanpa/tensorboardX helps?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I get AttributeError: 'NoneType' object has no attribute ...
NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None .
Read more >
Ticket: User Preferences throws AttributeError: 'NoneType ...
It's simply because there is no attribute with the name you called, for that Object. This means that you got the error when...
Read more >
Getting 'NoneType' object has no attribute 'id' error - Reddit
Can you help me solve this issue described on the post title? I am getting this error with this specific code: latest =…...
Read more >
Attributeerror: 'Nonetype' Object Has No Attribute 'Startswith ...
Attributeerror : 'Nonetype' Object Has No Attribute 'Startswith ... We are exited to announce that we have released Rocket. specific users ...
Read more >
AttributeError: 'NoneType' object has no attribute 'log' - Trac
AttributeError : 'NoneType' object has no attribute 'log' ... is masking the fact that it can't log another traceback (namely, clearsilver is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found