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.

An empty get_module() returning NotImplementedError will skip all unit tests!

See original GitHub issue

When a model in TorchBenchmark raises NotImplementedError in the get_module() function, it will skip all the unit tests!

This happens because test.py will accept and skip the exception, NotImplementedError. These are the reasons why every test is skipped:

  1. check_example
  2. check_device
    • check_example and check_device directly calls model.get_module(), which may raise NotImplementedError.
  3. train
  4. eval
    • train and eval unit tests call set_train() and set_eval() respectively before running the method
    • set_train/eval() will call _set_mode(), where (model, _) = self.get_module() is called and may raise NotImplementedError.

For 1 and 2, it may make sense to skip them since their functionality requires get_module(). However for 3 and 4, we may choose:

  • Overwrite _set_mode() to something that works (or pass).
  • Skip _set_mode() and directly run train and eval.
  • Require every model to implement get_module(). (This would also fix 1 and 2).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
janselcommented, Nov 18, 2021

Here are a couple examples of get_module() being used to check correctness of custom transformations:

Accomplishing the same thing with train()/eval() would not be possible with the current design. Especially the custom sync logic in the first example.

“is it of people’s interest to test the custom transformations on all the models?”

Yes this is the primary thing I use torchbench for.

1reaction
xuzhao9commented, Nov 19, 2021

Here are a couple examples of get_module() being used to check correctness of custom transformations:

Accomplishing the same thing with train()/eval() would not be possible with the current design. Especially the custom sync logic in the first example.

“is it of people’s interest to test the custom transformations on all the models?”

Yes this is the primary thing I use torchbench for.

Thank you for the explanation. Could you please help add get_module() interface to the models that are missing (listed by @aaronenyeshi in the comment above)? After that, we could fix a unit test that makes sure every model needs to implement this interface.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I skip a whole Python 'unittest' module at run time?
I can use @unittest.skipIf(...) to skip a unittest.TestCase class, but how do I skip the entire module? Applying skips to every class is...
Read more >
unittest — Unit testing framework
Skipping a test is simply a matter of using the skip() decorator or one of its conditional variants, calling TestCase.skipTest() within a setUp()...
Read more >
nose Documentation
nose collects tests from unittest.TestCase subclasses, of course. But you can also write simple test functions, as well as test classes that are ......
Read more >
7. Incomplete and Skipped Tests — PHPUnit 9.5 Manual
When you are working on a new test case class, you might want to begin by writing empty test methods such as: public...
Read more >
Python NotImplementedError | How to Avoid ...
When a Python content raises an exception, it should either deal with the exemption promptly else it ends and stops. Start Your Free...
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