aspire-inference 0.1.0a11__tar.gz → 0.1.0a12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/PKG-INFO +1 -1
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/aspire_inference.egg-info/PKG-INFO +1 -1
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/aspire.py +3 -2
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/utils.py +21 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/tests/test_utils.py +17 -1
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/.github/workflows/lint.yml +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/.github/workflows/publish.yml +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/.github/workflows/tests.yml +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/.gitignore +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/.pre-commit-config.yaml +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/LICENSE +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/README.md +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/aspire_inference.egg-info/SOURCES.txt +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/aspire_inference.egg-info/dependency_links.txt +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/aspire_inference.egg-info/requires.txt +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/aspire_inference.egg-info/top_level.txt +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/docs/Makefile +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/docs/checkpointing.rst +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/docs/conf.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/docs/entry_points.rst +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/docs/examples.rst +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/docs/index.rst +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/docs/installation.rst +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/docs/multiprocessing.rst +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/docs/recipes.rst +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/docs/requirements.txt +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/docs/user_guide.rst +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/examples/basic_example.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/examples/blackjax_smc_example.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/examples/smc_example.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/pyproject.toml +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/readthedocs.yml +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/setup.cfg +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/__init__.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/flows/__init__.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/flows/base.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/flows/jax/__init__.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/flows/jax/flows.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/flows/jax/utils.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/flows/torch/__init__.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/flows/torch/flows.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/history.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/plot.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/samplers/__init__.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/samplers/base.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/samplers/importance.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/samplers/mcmc.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/samplers/smc/__init__.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/samplers/smc/base.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/samplers/smc/blackjax.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/samplers/smc/emcee.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/samplers/smc/minipcn.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/samples.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/src/aspire/transforms.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/tests/conftest.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/tests/integration_tests/conftest.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/tests/integration_tests/test_checkpointing.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/tests/integration_tests/test_integration.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/tests/test_flows/test_flows_core.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/tests/test_flows/test_jax_flows/test_flowjax_flows.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/tests/test_flows/test_torch_flows/test_zuko_flows.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/tests/test_samples.py +0 -0
- {aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/tests/test_transforms.py +0 -0
|
@@ -20,6 +20,7 @@ from .transforms import (
|
|
|
20
20
|
)
|
|
21
21
|
from .utils import (
|
|
22
22
|
AspireFile,
|
|
23
|
+
function_id,
|
|
23
24
|
load_from_h5_file,
|
|
24
25
|
recursively_save_to_h5_file,
|
|
25
26
|
resolve_xp,
|
|
@@ -687,8 +688,8 @@ class Aspire:
|
|
|
687
688
|
method of the sampler.
|
|
688
689
|
"""
|
|
689
690
|
config = {
|
|
690
|
-
"log_likelihood": self.log_likelihood
|
|
691
|
-
"log_prior": self.log_prior
|
|
691
|
+
"log_likelihood": function_id(self.log_likelihood),
|
|
692
|
+
"log_prior": function_id(self.log_prior),
|
|
692
693
|
"dims": self.dims,
|
|
693
694
|
"parameters": self.parameters,
|
|
694
695
|
"periodic_parameters": self.periodic_parameters,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import functools
|
|
3
4
|
import inspect
|
|
4
5
|
import logging
|
|
5
6
|
import pickle
|
|
@@ -911,3 +912,23 @@ def track_calls(wrapped=None):
|
|
|
911
912
|
return wrapped_func(*args, **kwargs)
|
|
912
913
|
|
|
913
914
|
return wrapper(wrapped) if wrapped else wrapper
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
def function_id(fn: Any) -> str:
|
|
918
|
+
"""Get a unique identifier for a function.
|
|
919
|
+
|
|
920
|
+
Parameters
|
|
921
|
+
----------
|
|
922
|
+
fn : Any
|
|
923
|
+
The function to get the identifier for.
|
|
924
|
+
|
|
925
|
+
Returns
|
|
926
|
+
-------
|
|
927
|
+
str
|
|
928
|
+
The unique identifier for the function.
|
|
929
|
+
"""
|
|
930
|
+
if isinstance(fn, functools.partial):
|
|
931
|
+
base = fn.func
|
|
932
|
+
else:
|
|
933
|
+
base = fn
|
|
934
|
+
return f"{base.__module__}:{getattr(base, '__qualname__', type(base).__name__)}"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import functools
|
|
1
2
|
import pickle
|
|
2
3
|
|
|
3
4
|
import array_api_compat.numpy as np_xp
|
|
@@ -6,7 +7,7 @@ import h5py
|
|
|
6
7
|
import jax.numpy as jnp
|
|
7
8
|
import pytest
|
|
8
9
|
|
|
9
|
-
from aspire.utils import convert_dtype, dump_state, resolve_dtype
|
|
10
|
+
from aspire.utils import convert_dtype, dump_state, function_id, resolve_dtype
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def _dtype_name(dtype):
|
|
@@ -85,3 +86,18 @@ def test_dump_state_round_trip(tmp_path):
|
|
|
85
86
|
stored = fp["checkpoints"]["state"][...]
|
|
86
87
|
restored = pickle.loads(stored.tobytes())
|
|
87
88
|
assert restored == state
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# Define a simple function for testing
|
|
92
|
+
def _foo(x):
|
|
93
|
+
return x
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@pytest.mark.parametrize(
|
|
97
|
+
"fn", [lambda x: x, functools.partial(lambda x, y: x, y=1), _foo]
|
|
98
|
+
)
|
|
99
|
+
def test_function_id(fn):
|
|
100
|
+
fn_id = function_id(fn)
|
|
101
|
+
assert isinstance(fn_id, str)
|
|
102
|
+
# Calling again should give the same result
|
|
103
|
+
assert fn_id == function_id(fn)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/aspire_inference.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/aspire_inference.egg-info/requires.txt
RENAMED
|
File without changes
|
{aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/aspire_inference.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aspire_inference-0.1.0a11 → aspire_inference-0.1.0a12}/tests/integration_tests/test_integration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|