Change how the namespace is cleaned to be fully general. Right now, it filters all callables, but this filters some things which are pickable and callable.
Currently, users can interact with callable objects only in the init method. It's useful to use these elsewhere, for example I pass in optim.Adam or optim.SGD to switch between optimizers, more flexible than hardcoding strings.
rewrite clean_namespace to be something like:
for k,v in hparams.items():
try:
pickle.dumps(v)
except:
del_attrs.append(k)
@monney mind draft a PR to clarify what you mean?
@Borda I created a PR, it should also fix #2444 right now it's failing a test case, but my change shouldn't make it fail anything new. I tried the test case on my machine and it seems to work, so I'm not sure why it's failing
The test looks broken to me, it's checking for nn.CrossEntropyLoss, but it should be checking for nn.CosineEmbeddingLoss The version I have does that.