Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update pickling FAQ #1255

Merged
merged 1 commit into from
Sep 2, 2024
Merged

update pickling FAQ #1255

merged 1 commit into from
Sep 2, 2024

Conversation

michaeldeistler
Copy link
Contributor

See #1254

Sampling of old posteriors under v0.23.1 leads to errors. I don't think that these errors have an easy fix, so I am adding this to the FAQ.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[8], line 1
----> 1 posterior.sample((100,), x=torch.ones((1, 3)))

File [~/anaconda3/envs/sbidebug/lib/python3.12/site-packages/sbi/inference/posteriors/direct_posterior.py:111](http://localhost:8888/lab/workspaces/~/anaconda3/envs/sbidebug/lib/python3.12/site-packages/sbi/inference/posteriors/direct_posterior.py#line=110), in DirectPosterior.sample(self, sample_shape, x, max_sampling_batch_size, sample_with, show_progress_bars)
    108 num_samples = torch.Size(sample_shape).numel()
    109 x = self._x_else_default_x(x)
    110 x = reshape_to_batch_event(
--> 111     x, event_shape=self.posterior_estimator.condition_shape
    112 )
    114 max_sampling_batch_size = (
    115     self.max_sampling_batch_size
    116     if max_sampling_batch_size is None
    117     else max_sampling_batch_size
    118 )
    120 if sample_with is not None:

File [~/anaconda3/envs/sbidebug/lib/python3.12/site-packages/torch/nn/modules/module.py:1729](http://localhost:8888/lab/workspaces/~/anaconda3/envs/sbidebug/lib/python3.12/site-packages/torch/nn/modules/module.py#line=1728), in Module.__getattr__(self, name)
   1727     if name in modules:
   1728         return modules[name]
-> 1729 raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")

AttributeError: 'Flow' object has no attribute 'condition_shape'

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.16%. Comparing base (6dec812) to head (d76c7d5).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1255      +/-   ##
==========================================
- Coverage   86.05%   78.16%   -7.90%     
==========================================
  Files         118      118              
  Lines        8672     8679       +7     
==========================================
- Hits         7463     6784     -679     
- Misses       1209     1895     +686     
Flag Coverage Δ
unittests 78.16% <ø> (-7.90%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 28 files with indirect coverage changes

@michaeldeistler michaeldeistler merged commit 8afd985 into main Sep 2, 2024
6 checks passed
@michaeldeistler michaeldeistler deleted the faqpickle branch September 2, 2024 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants