When I try to use .sample when using a loaded approximator I get the following error:
ValueError: Cannot call forward with strict=False before calling forward with strict=True.
The issue does not come up when I try to use .sample straight after training the model (without first saving and loading it back in). I am using BayesFlow version 2.0.3.
Thanks for the context info! This reminds me of this issue that was also using offline training - could it be a similar problem that we have two disconnected adapters in the OfflineDataset and approximator here? I.e., I donāt know about the rest of your workflow but do you also load a saved dataset here?
If the source of the error is still unclear, it would help us a lot of you could open an issue with a minimal reproducible code example so that we can track down the issue. In the meantime, a quick bandaid fix so that you can continue with your project would be to manually call the adapter once (e.g., _ = adapter(data)) before sampling.
I think indeed the issue is similar, I create an offline dataset separately and load in this dataset using pickle. For now Iāve opted for the bandaid fix, which works fine for me.