Allow imports to work if openequivariance is installed but not running on supported GPU - #1534
Allow imports to work if openequivariance is installed but not running on supported GPU#1534bernstei wants to merge 1 commit into
Conversation
…g on supported GPU
aacostadiaz
left a comment
There was a problem hiding this comment.
Thanks for the fix! One small thing below, otherwise looks good to me.
| OEQ_AVAILABLE = True | ||
| except ImportError: | ||
| OEQ_AVAILABLE = False | ||
| except AssertionError as exc: |
There was a problem hiding this comment.
Two test files still have the same crash: tests/helpers.py and tests/backends/backend_parity.py. In those two files, catching AssertionError too is enough.
except (ImportError, AssertionError):
OEQ_AVAILABLE = FalseThere was a problem hiding this comment.
I'm sure that catching just any generic assertion error is enough, but I was trying to be careful, so that only the particular backend-related assertion was caught, to allow for other failure modes to still lead to an exception.
Do you not think we should apply that level of specificity to the tests as well? Who knows what other assertions those imports could trigger.
There was a problem hiding this comment.
That's a fair point and I think you're right. Let's keep your level of specificity in the tests too
Check for
AssertionErrorthat contains a specific string when importingopenequivariance, and allow it to continue without OEQ if it's caused by running on a non-supported GPU (e.g. torch CPU)closes #1532