Closed drscotthawley closed 6 months ago
This is because NATTEN uses logging not warnings for everything.
Setting the environment variable should get rid of them:
export NATTEN_LOG_LEVEL="critical"
...but pages and pages of the message are still coming through.
This concerns me. It shouldn't happen unless someone is recursively or iteratively importing from natten.functional
which is not good.
Ah ok thanks! Done.
Re. imports, code in question seems to be one line of import in one file, here: https://github.com/mir-aidj/all-in-one/blob/18e78903c0365147a2c5d4e5e57ebf88cb7d800e/src/allin1/models/dinat.py#L10:
from natten.functional import natten1dav, natten1dqkrpb, natten2dav, natten2dqkrpb
I don't see any recursive importing going on.
Not seeing any other imports of natten
, in fact a few places where it appears at all.
https://github.com/search?q=repo%3Amir-aidj%2Fall-in-one%20natten&type=code
Just running that import
line doesn't produce any messages at all, in my environment.
But the nattendav
routine gets called over & over via the forward
method of the main model. That seems to be when those messages are generated.
I'm ok to close this Issue if you like, however perhaps keeping it open until the multiple-messages issue is resolved would be to your preference.
Actually no you're right; the warning is issued per call. I don't think I'll change its behavior though given that we'll probably remove those in the next major release.
So as long as your issue is resolved we can close this.
Ok, sounds good. I'm going to fork that code and try to update it to use the newer version of NATTEN.
Hi, I'm using someone else's code and don't have the option to rewrite it. The warnings are a bit excessive (below).
I've tried ignoring a few different types e.g.
DeprecationWarning
,UserWarning
, such aseven tried just turning off all warnings (i.e. not specifying a category). I've tried putting such ignore directives at the top before any packages are imported, and further down after all packages have been imported.
...but pages and pages of the message are still coming through.
How can we disable these?