scire 0.1.1__py3-none-any.whl
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.
- scire/__init__.py +47 -0
- scire/factory.py +118 -0
- scire/module.py +258 -0
- scire/normalization.py +97 -0
- scire/vfdm.py +70 -0
- scire/vodm.py +112 -0
- scire-0.1.1.dist-info/METADATA +38 -0
- scire-0.1.1.dist-info/RECORD +11 -0
- scire-0.1.1.dist-info/WHEEL +5 -0
- scire-0.1.1.dist-info/licenses/LICENSE +21 -0
- scire-0.1.1.dist-info/top_level.txt +1 -0
scire/__init__.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""SCIRE: Seeking Curiosity, Intrinsic Reward, and Empowerment.
|
|
2
|
+
|
|
3
|
+
A unified, environment-agnostic intrinsic reward framework for reinforcement
|
|
4
|
+
learning, combining three complementary drives:
|
|
5
|
+
|
|
6
|
+
- VODM (Variational Observation Density Model) estimates **novelty**: how
|
|
7
|
+
unfamiliar an observation is, as its negative ELBO under a learned VAE.
|
|
8
|
+
- VFDM (Variational Forward Dynamics Model) estimates **surprise**: epistemic
|
|
9
|
+
uncertainty in predicting the next observation from the current one.
|
|
10
|
+
- VEDM (empowerment) estimates **controllable state diversity**, by rolling
|
|
11
|
+
out candidate action sequences through VFDM's own learned dynamics model
|
|
12
|
+
and rewarding sequences that reliably reach a variety of outcomes.
|
|
13
|
+
|
|
14
|
+
SCIRE only needs an observation dimension and an action dimension; it makes
|
|
15
|
+
no assumptions about the environment, observation range, or action type
|
|
16
|
+
(discrete or continuous), so it can be dropped into any intrinsically
|
|
17
|
+
motivated RL setup.
|
|
18
|
+
|
|
19
|
+
Basic usage:
|
|
20
|
+
>>> import jax
|
|
21
|
+
>>> from scire import create_scire_system, compute_intrinsic_reward
|
|
22
|
+
>>> key = jax.random.PRNGKey(0)
|
|
23
|
+
>>> model, params, action_sequences = create_scire_system(key, obs_dim=32, action_dim=4)
|
|
24
|
+
>>> reward, info = compute_intrinsic_reward(
|
|
25
|
+
... model, params, obs_batch, action_batch, next_obs_batch, action_sequences,
|
|
26
|
+
... key, novelty_weight=1e-3, surprise_weight=1e-3, empowerment_weight=1e-3,
|
|
27
|
+
... )
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
from scire.factory import create_scire_system, generate_action_sequences
|
|
31
|
+
from scire.module import SCIREModule, compute_intrinsic_reward
|
|
32
|
+
from scire.normalization import NormalizerState, RunningStats
|
|
33
|
+
from scire.vfdm import VFDM
|
|
34
|
+
from scire.vodm import VODM
|
|
35
|
+
|
|
36
|
+
__all__ = [
|
|
37
|
+
"VODM",
|
|
38
|
+
"VFDM",
|
|
39
|
+
"SCIREModule",
|
|
40
|
+
"compute_intrinsic_reward",
|
|
41
|
+
"create_scire_system",
|
|
42
|
+
"generate_action_sequences",
|
|
43
|
+
"NormalizerState",
|
|
44
|
+
"RunningStats",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
__version__ = "0.1.1"
|
scire/factory.py
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"""Convenience constructors for the SCIRE intrinsic reward system."""
|
|
2
|
+
|
|
3
|
+
from typing import Tuple
|
|
4
|
+
|
|
5
|
+
import jax
|
|
6
|
+
import jax.numpy as jnp
|
|
7
|
+
|
|
8
|
+
from scire.module import SCIREModule
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def generate_action_sequences(
|
|
12
|
+
key: jax.random.PRNGKey,
|
|
13
|
+
action_dim: int,
|
|
14
|
+
planning_horizon: int,
|
|
15
|
+
num_action_sequences: int,
|
|
16
|
+
max_exhaustive_sequences: int = 216,
|
|
17
|
+
) -> jnp.ndarray:
|
|
18
|
+
"""Generate a fixed bank of candidate action sequences used to estimate VEDM's empowerment.
|
|
19
|
+
|
|
20
|
+
When the full action space (`action_dim ** planning_horizon`) is at most
|
|
21
|
+
`max_exhaustive_sequences`, every possible sequence is enumerated (subsampling
|
|
22
|
+
down to `num_action_sequences` if there are more than needed); otherwise,
|
|
23
|
+
`num_action_sequences` sequences are drawn uniformly at random.
|
|
24
|
+
"""
|
|
25
|
+
total_possible = action_dim ** planning_horizon
|
|
26
|
+
|
|
27
|
+
if total_possible <= max_exhaustive_sequences:
|
|
28
|
+
all_sequences = []
|
|
29
|
+
for i in range(total_possible):
|
|
30
|
+
sequence = []
|
|
31
|
+
temp = i
|
|
32
|
+
for _ in range(planning_horizon):
|
|
33
|
+
sequence.append(temp % action_dim)
|
|
34
|
+
temp = temp // action_dim
|
|
35
|
+
all_sequences.append(sequence)
|
|
36
|
+
|
|
37
|
+
if total_possible > num_action_sequences:
|
|
38
|
+
select_indices = jax.random.choice(
|
|
39
|
+
key, jnp.arange(total_possible), (num_action_sequences,), replace=False
|
|
40
|
+
)
|
|
41
|
+
all_sequences = [all_sequences[i] for i in select_indices]
|
|
42
|
+
elif total_possible < num_action_sequences:
|
|
43
|
+
extra = jax.random.randint(
|
|
44
|
+
key,
|
|
45
|
+
shape=(num_action_sequences - total_possible, planning_horizon),
|
|
46
|
+
minval=0,
|
|
47
|
+
maxval=action_dim,
|
|
48
|
+
).tolist()
|
|
49
|
+
all_sequences.extend(extra)
|
|
50
|
+
|
|
51
|
+
return jnp.array(all_sequences)
|
|
52
|
+
|
|
53
|
+
return jax.random.randint(
|
|
54
|
+
key, shape=(num_action_sequences, planning_horizon), minval=0, maxval=action_dim
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def create_scire_system(
|
|
59
|
+
key: jax.random.PRNGKey,
|
|
60
|
+
obs_dim: int,
|
|
61
|
+
action_dim: int,
|
|
62
|
+
hidden_dim: int = 512,
|
|
63
|
+
latent_dim: int = 128,
|
|
64
|
+
planning_horizon: int = 3,
|
|
65
|
+
num_action_sequences: int = 10,
|
|
66
|
+
beta_vae: float = 1.0,
|
|
67
|
+
logvar_min: float = -10.0,
|
|
68
|
+
logvar_max: float = 2.0,
|
|
69
|
+
latent_pred_coef: float = 0.1,
|
|
70
|
+
max_exhaustive_sequences: int = 216,
|
|
71
|
+
) -> Tuple[SCIREModule, dict, jnp.ndarray]:
|
|
72
|
+
"""Create and initialize a SCIRE (VODM + VFDM + VEDM) intrinsic reward system.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
key: PRNG key used for both parameter initialization and action-sequence sampling.
|
|
76
|
+
obs_dim: Dimensionality of a single (flattened) observation.
|
|
77
|
+
action_dim: Number of discrete actions, or the dimensionality of a continuous
|
|
78
|
+
action vector.
|
|
79
|
+
hidden_dim: Width of every hidden layer in VODM and VFDM.
|
|
80
|
+
latent_dim: Dimensionality of VODM's/VFDM's shared latent space.
|
|
81
|
+
planning_horizon: Number of steps VEDM rolls out when estimating empowerment.
|
|
82
|
+
num_action_sequences: How many candidate action sequences VEDM evaluates per step.
|
|
83
|
+
beta_vae: Weight on VODM's KL term (beta-VAE style disentanglement pressure).
|
|
84
|
+
logvar_min: Lower clip bound for all predicted log-variances (numerical stability).
|
|
85
|
+
logvar_max: Upper clip bound for all predicted log-variances (numerical stability).
|
|
86
|
+
latent_pred_coef: Weight on the auxiliary latent-space prediction loss in
|
|
87
|
+
`SCIREModule.compute_training_loss`.
|
|
88
|
+
max_exhaustive_sequences: See `generate_action_sequences`.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
(model, params, action_sequences): the stateless `SCIREModule`, its initialized
|
|
92
|
+
Flax parameters, and the fixed bank of action sequences to pass to
|
|
93
|
+
`compute_empowerment` / `compute_intrinsic_reward`.
|
|
94
|
+
"""
|
|
95
|
+
init_key, action_seq_key = jax.random.split(key)
|
|
96
|
+
|
|
97
|
+
model = SCIREModule(
|
|
98
|
+
obs_dim=obs_dim,
|
|
99
|
+
action_dim=action_dim,
|
|
100
|
+
hidden_dim=hidden_dim,
|
|
101
|
+
latent_dim=latent_dim,
|
|
102
|
+
beta_vae=beta_vae,
|
|
103
|
+
logvar_min=logvar_min,
|
|
104
|
+
logvar_max=logvar_max,
|
|
105
|
+
latent_pred_coef=latent_pred_coef,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
action_sequences = generate_action_sequences(
|
|
109
|
+
action_seq_key, action_dim, planning_horizon, num_action_sequences, max_exhaustive_sequences
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
dummy_obs = jnp.zeros((1, obs_dim))
|
|
113
|
+
dummy_action = jnp.zeros((1,), dtype=jnp.int32)
|
|
114
|
+
dummy_next_obs = jnp.zeros((1, obs_dim))
|
|
115
|
+
|
|
116
|
+
params = model.init(init_key, dummy_obs, dummy_action, dummy_next_obs, action_sequences, init_key)
|
|
117
|
+
|
|
118
|
+
return model, params, action_sequences
|
scire/module.py
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"""SCIREModule: the unified SCIRE intrinsic reward system.
|
|
2
|
+
|
|
3
|
+
Combines three components, each named after the variational model that
|
|
4
|
+
produces it:
|
|
5
|
+
|
|
6
|
+
- VODM (novelty): -log p(x), via a variational autoencoder's negative ELBO.
|
|
7
|
+
- VFDM (surprise): epistemic uncertainty in the forward-dynamics model's
|
|
8
|
+
predictions of the next observation.
|
|
9
|
+
- VEDM (empowerment): controllable state diversity. VEDM is not a separate
|
|
10
|
+
network; it simulates short trajectories by chaining
|
|
11
|
+
VFDM's single-step latent predictions under candidate
|
|
12
|
+
action sequences, then rewards sequences that reach
|
|
13
|
+
diverse outcomes *reliably* (low predicted variance
|
|
14
|
+
along the way), rather than diversity coming from
|
|
15
|
+
environment randomness.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from typing import Any, Dict, Optional, Tuple
|
|
19
|
+
|
|
20
|
+
import chex
|
|
21
|
+
import flax.linen as nn
|
|
22
|
+
import jax
|
|
23
|
+
import jax.numpy as jnp
|
|
24
|
+
|
|
25
|
+
from scire.normalization import NormalizerState
|
|
26
|
+
from scire.vfdm import VFDM
|
|
27
|
+
from scire.vodm import VODM
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class SCIREModule(nn.Module):
|
|
31
|
+
"""Unified SCIRE intrinsic reward module: VODM + VFDM + VEDM."""
|
|
32
|
+
|
|
33
|
+
obs_dim: int
|
|
34
|
+
action_dim: int
|
|
35
|
+
hidden_dim: int = 512
|
|
36
|
+
latent_dim: int = 128
|
|
37
|
+
beta_vae: float = 1.0
|
|
38
|
+
logvar_min: float = -10.0
|
|
39
|
+
logvar_max: float = 2.0
|
|
40
|
+
latent_pred_coef: float = 0.1
|
|
41
|
+
|
|
42
|
+
def setup(self):
|
|
43
|
+
self.vodm = VODM(
|
|
44
|
+
obs_dim=self.obs_dim,
|
|
45
|
+
hidden_dim=self.hidden_dim,
|
|
46
|
+
latent_dim=self.latent_dim,
|
|
47
|
+
logvar_min=self.logvar_min,
|
|
48
|
+
logvar_max=self.logvar_max,
|
|
49
|
+
)
|
|
50
|
+
self.vfdm = VFDM(
|
|
51
|
+
obs_dim=self.obs_dim,
|
|
52
|
+
latent_dim=self.latent_dim,
|
|
53
|
+
action_dim=self.action_dim,
|
|
54
|
+
hidden_dim=self.hidden_dim,
|
|
55
|
+
logvar_min=self.logvar_min,
|
|
56
|
+
logvar_max=self.logvar_max,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
def _one_hot_action(self, action: chex.Array) -> chex.Array:
|
|
60
|
+
if action.ndim == 1 or action.shape[-1] != self.action_dim:
|
|
61
|
+
return jax.nn.one_hot(action, self.action_dim)
|
|
62
|
+
return action
|
|
63
|
+
|
|
64
|
+
def __call__(self, obs: chex.Array, action: chex.Array, next_obs: chex.Array,
|
|
65
|
+
action_sequences: chex.Array, key: chex.PRNGKey) -> chex.Array:
|
|
66
|
+
"""Exercises every submodule so Flax initializes all parameters at once.
|
|
67
|
+
|
|
68
|
+
`compute_novelty`/`compute_surprise`/`compute_empowerment` alone don't touch
|
|
69
|
+
VFDM's `next_obs_predictor` (only `compute_training_loss` needs it, via
|
|
70
|
+
`predict_observation`), so it's called explicitly here too, or its
|
|
71
|
+
parameters would be missing from `params` at training time.
|
|
72
|
+
"""
|
|
73
|
+
key1, key2, key3 = jax.random.split(key, 3)
|
|
74
|
+
novelty, _ = self.compute_novelty(obs, key=key1)
|
|
75
|
+
surprise, _ = self.compute_surprise(obs, action, next_obs, key=key2)
|
|
76
|
+
empowerment, _ = self.compute_empowerment(obs, action_sequences, key=key3)
|
|
77
|
+
|
|
78
|
+
action_onehot = self._one_hot_action(action)
|
|
79
|
+
z_mu, _ = self.vodm.encode(obs)
|
|
80
|
+
_ = self.vfdm.predict_observation(z_mu, action_onehot)
|
|
81
|
+
|
|
82
|
+
return novelty + surprise + empowerment
|
|
83
|
+
|
|
84
|
+
def compute_novelty(
|
|
85
|
+
self, obs: chex.Array, key: Optional[chex.PRNGKey] = None
|
|
86
|
+
) -> Tuple[chex.Array, Dict[str, chex.Array]]:
|
|
87
|
+
"""VODM: novelty as negative ELBO, an upper bound on -log p(x)."""
|
|
88
|
+
return self.vodm.compute_negative_elbo(obs, key=key, beta=self.beta_vae)
|
|
89
|
+
|
|
90
|
+
def compute_surprise(
|
|
91
|
+
self,
|
|
92
|
+
obs: chex.Array,
|
|
93
|
+
action: chex.Array,
|
|
94
|
+
next_obs: chex.Array,
|
|
95
|
+
key: Optional[chex.PRNGKey] = None,
|
|
96
|
+
num_samples: int = 5,
|
|
97
|
+
) -> Tuple[chex.Array, Dict[str, chex.Array]]:
|
|
98
|
+
"""VFDM: surprise as epistemic uncertainty in the model's next-state predictions.
|
|
99
|
+
|
|
100
|
+
Draws `num_samples` latent samples for the current observation and measures
|
|
101
|
+
how much the predicted next state varies across them: high variance means
|
|
102
|
+
the model is uncertain about this transition (curiosity-worthy), while low
|
|
103
|
+
variance means the model has already learned this region well.
|
|
104
|
+
"""
|
|
105
|
+
action_onehot = self._one_hot_action(action)
|
|
106
|
+
z_mu, z_logvar = self.vodm.encode(obs)
|
|
107
|
+
next_mu, _ = self.vodm.encode(next_obs)
|
|
108
|
+
|
|
109
|
+
if key is None:
|
|
110
|
+
pred_mu, _ = self.vfdm.predict_latent(z_mu, action_onehot)
|
|
111
|
+
prediction_error = jnp.mean((pred_mu - next_mu) ** 2, axis=-1)
|
|
112
|
+
info = {
|
|
113
|
+
"epistemic_uncertainty": jnp.zeros_like(prediction_error),
|
|
114
|
+
"prediction_error": prediction_error,
|
|
115
|
+
}
|
|
116
|
+
return prediction_error, info
|
|
117
|
+
|
|
118
|
+
keys = jax.random.split(key, num_samples)
|
|
119
|
+
z_samples = jax.vmap(lambda k: self.vodm.reparameterize(z_mu, z_logvar, k))(keys)
|
|
120
|
+
pred_samples = jax.vmap(lambda z: self.vfdm.predict_latent(z, action_onehot)[0])(z_samples)
|
|
121
|
+
epistemic_uncertainty = jnp.mean(jnp.var(pred_samples, axis=0), axis=-1)
|
|
122
|
+
|
|
123
|
+
pred_mu, _ = self.vfdm.predict_latent(z_mu, action_onehot)
|
|
124
|
+
prediction_error = jnp.mean((pred_mu - next_mu) ** 2, axis=-1)
|
|
125
|
+
|
|
126
|
+
info = {
|
|
127
|
+
"epistemic_uncertainty": epistemic_uncertainty,
|
|
128
|
+
"prediction_error": prediction_error,
|
|
129
|
+
}
|
|
130
|
+
return epistemic_uncertainty, info
|
|
131
|
+
|
|
132
|
+
def compute_empowerment(
|
|
133
|
+
self, obs: chex.Array, action_sequences: chex.Array, key: Optional[chex.PRNGKey] = None
|
|
134
|
+
) -> Tuple[chex.Array, Dict[str, chex.Array]]:
|
|
135
|
+
"""VEDM: empowerment as controllable state diversity over simulated rollouts.
|
|
136
|
+
|
|
137
|
+
Each candidate action sequence is rolled out through VFDM's latent dynamics
|
|
138
|
+
model. Empowerment = diversity * controllability, where diversity is the
|
|
139
|
+
variance of the states reached by different sequences, and controllability
|
|
140
|
+
is derived from how confidently the model predicted each rollout (low
|
|
141
|
+
predicted variance along the way = high controllability). This rewards
|
|
142
|
+
agents that can reliably reach a variety of outcomes, not agents that merely
|
|
143
|
+
experience diversity from environment randomness.
|
|
144
|
+
"""
|
|
145
|
+
del key # empowerment's rollout is deterministic (uses predicted means)
|
|
146
|
+
batch_size = obs.shape[0]
|
|
147
|
+
num_sequences = action_sequences.shape[0]
|
|
148
|
+
seq_length = action_sequences.shape[1]
|
|
149
|
+
|
|
150
|
+
z_mu, _ = self.vodm.encode(obs)
|
|
151
|
+
z = jnp.tile(z_mu[:, None, :], (1, num_sequences, 1)).reshape(-1, self.latent_dim)
|
|
152
|
+
action_seqs = jnp.tile(action_sequences[None, :, :], (batch_size, 1, 1)).reshape(-1, seq_length)
|
|
153
|
+
|
|
154
|
+
trajectory_uncertainty = jnp.zeros(z.shape[0])
|
|
155
|
+
for t in range(seq_length):
|
|
156
|
+
action_onehot = jax.nn.one_hot(action_seqs[:, t], self.action_dim)
|
|
157
|
+
mu_next, logvar_next = self.vfdm.predict_latent(z, action_onehot)
|
|
158
|
+
trajectory_uncertainty = trajectory_uncertainty + jnp.mean(jnp.exp(logvar_next), axis=-1)
|
|
159
|
+
z = mu_next
|
|
160
|
+
|
|
161
|
+
z_final = z.reshape(batch_size, num_sequences, self.latent_dim)
|
|
162
|
+
diversity = jnp.mean(jnp.var(z_final, axis=1), axis=-1)
|
|
163
|
+
|
|
164
|
+
avg_uncertainty = jnp.mean(trajectory_uncertainty.reshape(batch_size, num_sequences), axis=1)
|
|
165
|
+
controllability = jnp.exp(-avg_uncertainty)
|
|
166
|
+
|
|
167
|
+
empowerment = diversity * controllability
|
|
168
|
+
info = {"diversity": diversity, "controllability": controllability}
|
|
169
|
+
return empowerment, info
|
|
170
|
+
|
|
171
|
+
def compute_training_loss(
|
|
172
|
+
self, obs: chex.Array, action: chex.Array, next_obs: chex.Array, key: chex.PRNGKey, beta_kl: float = 0.1
|
|
173
|
+
) -> Tuple[chex.Array, Dict[str, chex.Array]]:
|
|
174
|
+
"""Joint VODM + VFDM training loss: reconstruction + KL + forward-dynamics prediction error."""
|
|
175
|
+
action_onehot = self._one_hot_action(action)
|
|
176
|
+
|
|
177
|
+
obs_mu, obs_logvar = self.vodm.encode(obs)
|
|
178
|
+
obs_z = self.vodm.reparameterize(obs_mu, obs_logvar, key)
|
|
179
|
+
obs_recon, _ = self.vodm.decode(obs_z)
|
|
180
|
+
|
|
181
|
+
recon_loss = jnp.mean((obs_recon - obs) ** 2)
|
|
182
|
+
kl_loss = -0.5 * jnp.mean(1 + obs_logvar - obs_mu ** 2 - jnp.exp(obs_logvar))
|
|
183
|
+
|
|
184
|
+
pred_next_obs = self.vfdm.predict_observation(obs_mu, action_onehot)
|
|
185
|
+
pred_loss = jnp.mean((pred_next_obs - next_obs) ** 2)
|
|
186
|
+
|
|
187
|
+
next_obs_mu, _ = self.vodm.encode(next_obs)
|
|
188
|
+
pred_next_mu, _ = self.vfdm.predict_latent(obs_mu, action_onehot)
|
|
189
|
+
latent_pred_loss = jnp.mean((pred_next_mu - next_obs_mu) ** 2)
|
|
190
|
+
|
|
191
|
+
total_loss = recon_loss + beta_kl * kl_loss + pred_loss + self.latent_pred_coef * latent_pred_loss
|
|
192
|
+
|
|
193
|
+
loss_info = {
|
|
194
|
+
"recon_loss": recon_loss,
|
|
195
|
+
"kl_loss": kl_loss,
|
|
196
|
+
"pred_loss": pred_loss,
|
|
197
|
+
"latent_pred_loss": latent_pred_loss,
|
|
198
|
+
}
|
|
199
|
+
return total_loss, loss_info
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def compute_intrinsic_reward(
|
|
203
|
+
model: SCIREModule,
|
|
204
|
+
params: Dict[str, Any],
|
|
205
|
+
obs: chex.Array,
|
|
206
|
+
action: chex.Array,
|
|
207
|
+
next_obs: chex.Array,
|
|
208
|
+
action_sequences: chex.Array,
|
|
209
|
+
key: chex.PRNGKey,
|
|
210
|
+
novelty_weight: float,
|
|
211
|
+
surprise_weight: float,
|
|
212
|
+
empowerment_weight: float,
|
|
213
|
+
normalizer_state: Optional[NormalizerState] = None,
|
|
214
|
+
update_normalizer: bool = False,
|
|
215
|
+
) -> Tuple[chex.Array, Dict[str, Any]]:
|
|
216
|
+
"""Compute the combined SCIRE intrinsic reward for a batch of transitions.
|
|
217
|
+
|
|
218
|
+
Pass `normalizer_state` (see `scire.normalization.NormalizerState`) to keep the
|
|
219
|
+
three components on a comparable [0, 1] scale; without it, the raw VODM/VFDM/VEDM
|
|
220
|
+
magnitudes are combined directly, which can let one component dominate.
|
|
221
|
+
|
|
222
|
+
This function, `model.apply`, and jax transforms compose normally: wrap it in
|
|
223
|
+
`jax.jit` yourself with `model` as a static argument if you need it compiled.
|
|
224
|
+
"""
|
|
225
|
+
key_nov, key_sur, key_emp = jax.random.split(key, 3)
|
|
226
|
+
|
|
227
|
+
novelty, novelty_info = model.apply(params, obs, key=key_nov, method=model.compute_novelty)
|
|
228
|
+
surprise, surprise_info = model.apply(
|
|
229
|
+
params, obs, action, next_obs, key=key_sur, method=model.compute_surprise
|
|
230
|
+
)
|
|
231
|
+
empowerment, empowerment_info = model.apply(
|
|
232
|
+
params, obs, action_sequences, key=key_emp, method=model.compute_empowerment
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
if normalizer_state is not None:
|
|
236
|
+
if update_normalizer:
|
|
237
|
+
normalizer_state = normalizer_state.update(novelty, surprise, empowerment)
|
|
238
|
+
novelty_n, surprise_n, empowerment_n = normalizer_state.normalize(novelty, surprise, empowerment)
|
|
239
|
+
else:
|
|
240
|
+
novelty_n, surprise_n, empowerment_n = novelty, surprise, empowerment
|
|
241
|
+
|
|
242
|
+
total_reward = (
|
|
243
|
+
novelty_weight * novelty_n + surprise_weight * surprise_n + empowerment_weight * empowerment_n
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
info = {
|
|
247
|
+
"novelty_raw": novelty,
|
|
248
|
+
"surprise_raw": surprise,
|
|
249
|
+
"empowerment_raw": empowerment,
|
|
250
|
+
"novelty_normalized": novelty_n,
|
|
251
|
+
"surprise_normalized": surprise_n,
|
|
252
|
+
"empowerment_normalized": empowerment_n,
|
|
253
|
+
"normalizer_state": normalizer_state,
|
|
254
|
+
**{f"novelty_{k}": v for k, v in novelty_info.items()},
|
|
255
|
+
**{f"surprise_{k}": v for k, v in surprise_info.items()},
|
|
256
|
+
**{f"empowerment_{k}": v for k, v in empowerment_info.items()},
|
|
257
|
+
}
|
|
258
|
+
return total_reward, info
|
scire/normalization.py
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"""Running statistics for normalizing SCIRE's three reward components.
|
|
2
|
+
|
|
3
|
+
VODM (novelty), VFDM (surprise), and VEDM (empowerment) naturally live on
|
|
4
|
+
different, non-stationary scales as training progresses. `NormalizerState`
|
|
5
|
+
tracks per-component running min/max/mean/variance (via Welford's online
|
|
6
|
+
algorithm) and rescales each raw value to [0, 1], so a fixed set of weights
|
|
7
|
+
stays meaningful across components and across training.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from typing import NamedTuple, Tuple
|
|
11
|
+
|
|
12
|
+
import chex
|
|
13
|
+
import jax.numpy as jnp
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class RunningStats(NamedTuple):
|
|
17
|
+
"""Online mean/variance/min/max tracker for a single scalar reward component."""
|
|
18
|
+
|
|
19
|
+
mean: chex.Array
|
|
20
|
+
var: chex.Array
|
|
21
|
+
count: chex.Array
|
|
22
|
+
min_val: chex.Array
|
|
23
|
+
max_val: chex.Array
|
|
24
|
+
sum_sq: chex.Array
|
|
25
|
+
|
|
26
|
+
@staticmethod
|
|
27
|
+
def init() -> "RunningStats":
|
|
28
|
+
return RunningStats(
|
|
29
|
+
mean=jnp.zeros((), dtype=jnp.float32),
|
|
30
|
+
var=jnp.ones((), dtype=jnp.float32),
|
|
31
|
+
count=jnp.zeros((), dtype=jnp.float32),
|
|
32
|
+
min_val=jnp.array(float("inf"), dtype=jnp.float32),
|
|
33
|
+
max_val=jnp.array(float("-inf"), dtype=jnp.float32),
|
|
34
|
+
sum_sq=jnp.zeros((), dtype=jnp.float32),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
def update(self, batch: chex.Array) -> "RunningStats":
|
|
38
|
+
"""Update running mean/variance/min/max with a new batch using Welford's algorithm."""
|
|
39
|
+
batch_flat = jnp.atleast_1d(batch).flatten()
|
|
40
|
+
batch_size = batch_flat.shape[0]
|
|
41
|
+
|
|
42
|
+
new_min = jnp.minimum(self.min_val, jnp.min(batch_flat))
|
|
43
|
+
new_max = jnp.maximum(self.max_val, jnp.max(batch_flat))
|
|
44
|
+
|
|
45
|
+
new_count = self.count + batch_size
|
|
46
|
+
delta = batch_flat - self.mean
|
|
47
|
+
new_mean = self.mean + jnp.sum(delta) / new_count
|
|
48
|
+
delta2 = batch_flat - new_mean
|
|
49
|
+
new_sum_sq = self.sum_sq + jnp.sum(delta * delta2)
|
|
50
|
+
new_var = jnp.where(new_count > 1, new_sum_sq / new_count, jnp.ones_like(self.var))
|
|
51
|
+
|
|
52
|
+
return RunningStats(
|
|
53
|
+
mean=new_mean, var=new_var, count=new_count,
|
|
54
|
+
min_val=new_min, max_val=new_max, sum_sq=new_sum_sq,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
def normalize(self, x: chex.Array, eps: float = 1e-8) -> chex.Array:
|
|
58
|
+
"""Min-max normalize x to [0, 1] using the observed running min/max."""
|
|
59
|
+
range_val = self.max_val - self.min_val
|
|
60
|
+
safe_range = jnp.where(range_val > eps, range_val, jnp.ones_like(range_val))
|
|
61
|
+
normalized = jnp.clip((x - self.min_val) / safe_range, 0.0, 1.0)
|
|
62
|
+
# If we haven't observed enough spread yet, fall back to a neutral 0.5
|
|
63
|
+
return jnp.where(range_val > eps, normalized, 0.5 * jnp.ones_like(normalized))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class NormalizerState(NamedTuple):
|
|
67
|
+
"""Tracks and applies per-component normalization for novelty, surprise, and empowerment."""
|
|
68
|
+
|
|
69
|
+
novelty_stats: RunningStats
|
|
70
|
+
surprise_stats: RunningStats
|
|
71
|
+
empowerment_stats: RunningStats
|
|
72
|
+
|
|
73
|
+
@staticmethod
|
|
74
|
+
def init() -> "NormalizerState":
|
|
75
|
+
return NormalizerState(
|
|
76
|
+
novelty_stats=RunningStats.init(),
|
|
77
|
+
surprise_stats=RunningStats.init(),
|
|
78
|
+
empowerment_stats=RunningStats.init(),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
def update(self, novelty: chex.Array, surprise: chex.Array, empowerment: chex.Array) -> "NormalizerState":
|
|
82
|
+
"""Update running statistics for all three components with a new batch."""
|
|
83
|
+
return NormalizerState(
|
|
84
|
+
novelty_stats=self.novelty_stats.update(novelty),
|
|
85
|
+
surprise_stats=self.surprise_stats.update(surprise),
|
|
86
|
+
empowerment_stats=self.empowerment_stats.update(empowerment),
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
def normalize(
|
|
90
|
+
self, novelty: chex.Array, surprise: chex.Array, empowerment: chex.Array
|
|
91
|
+
) -> Tuple[chex.Array, chex.Array, chex.Array]:
|
|
92
|
+
"""Min-max normalize all three components to [0, 1] for consistent, comparable scaling."""
|
|
93
|
+
return (
|
|
94
|
+
self.novelty_stats.normalize(novelty),
|
|
95
|
+
self.surprise_stats.normalize(surprise),
|
|
96
|
+
self.empowerment_stats.normalize(empowerment),
|
|
97
|
+
)
|
scire/vfdm.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""VFDM: Variational Forward Dynamics Model.
|
|
2
|
+
|
|
3
|
+
Learns to predict the next observation given the current latent state and
|
|
4
|
+
action. Surprise is estimated as epistemic uncertainty in these predictions.
|
|
5
|
+
VEDM (empowerment) reuses this same learned dynamics model to simulate
|
|
6
|
+
multi-step trajectories, so VFDM has no separate "planning" mode of its own:
|
|
7
|
+
every call predicts exactly one step ahead, and multi-step rollouts are built
|
|
8
|
+
by chaining single-step calls (see `scire.module.SCIREModule.compute_empowerment`).
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from typing import Tuple
|
|
12
|
+
|
|
13
|
+
import chex
|
|
14
|
+
import flax.linen as nn
|
|
15
|
+
import jax
|
|
16
|
+
import jax.numpy as jnp
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class VFDM(nn.Module):
|
|
20
|
+
"""Variational Forward Dynamics Model used for surprise estimation (and, via
|
|
21
|
+
chained single-step rollouts, for VEDM's empowerment estimation)."""
|
|
22
|
+
|
|
23
|
+
obs_dim: int
|
|
24
|
+
latent_dim: int
|
|
25
|
+
action_dim: int
|
|
26
|
+
hidden_dim: int = 512
|
|
27
|
+
logvar_min: float = -10.0
|
|
28
|
+
logvar_max: float = 2.0
|
|
29
|
+
|
|
30
|
+
def setup(self):
|
|
31
|
+
self.dynamics_1 = nn.Dense(self.hidden_dim)
|
|
32
|
+
self.dynamics_2 = nn.Dense(self.hidden_dim)
|
|
33
|
+
self.dynamics_3 = nn.Dense(self.hidden_dim)
|
|
34
|
+
self.dynamics_4 = nn.Dense(self.hidden_dim)
|
|
35
|
+
self.dynamics_norm_1 = nn.LayerNorm()
|
|
36
|
+
self.dynamics_norm_2 = nn.LayerNorm()
|
|
37
|
+
self.dynamics_norm_3 = nn.LayerNorm()
|
|
38
|
+
self.dynamics_norm_4 = nn.LayerNorm()
|
|
39
|
+
|
|
40
|
+
self.pred_mu_layer = nn.Dense(self.latent_dim)
|
|
41
|
+
self.pred_logvar_layer = nn.Dense(self.latent_dim)
|
|
42
|
+
self.next_obs_predictor = nn.Dense(self.obs_dim)
|
|
43
|
+
|
|
44
|
+
def _dynamics_features(self, z: chex.Array, action: chex.Array) -> chex.Array:
|
|
45
|
+
x = jnp.concatenate([z, action], axis=-1)
|
|
46
|
+
h1 = nn.relu(self.dynamics_1(x))
|
|
47
|
+
h1 = self.dynamics_norm_1(h1)
|
|
48
|
+
h2 = nn.relu(self.dynamics_2(h1))
|
|
49
|
+
h2 = self.dynamics_norm_2(h2) + h1
|
|
50
|
+
h3 = nn.relu(self.dynamics_3(h2))
|
|
51
|
+
h3 = self.dynamics_norm_3(h3) + h2
|
|
52
|
+
h4 = nn.relu(self.dynamics_4(h3))
|
|
53
|
+
h4 = self.dynamics_norm_4(h4) + h3
|
|
54
|
+
return h4
|
|
55
|
+
|
|
56
|
+
def predict_latent(self, z: chex.Array, action: chex.Array) -> Tuple[chex.Array, chex.Array]:
|
|
57
|
+
"""Predict the next latent distribution p(z'|z, a)."""
|
|
58
|
+
h4 = self._dynamics_features(z, action)
|
|
59
|
+
mu = self.pred_mu_layer(h4)
|
|
60
|
+
logvar = jnp.clip(self.pred_logvar_layer(h4), self.logvar_min, self.logvar_max)
|
|
61
|
+
return mu, logvar
|
|
62
|
+
|
|
63
|
+
def predict_observation(self, z: chex.Array, action: chex.Array) -> chex.Array:
|
|
64
|
+
"""Predict the next observation directly (used for surprise's MSE prediction error).
|
|
65
|
+
|
|
66
|
+
Outputs an unconstrained real-valued vector, matching VODM's Gaussian
|
|
67
|
+
observation model, so it works with observations in any range.
|
|
68
|
+
"""
|
|
69
|
+
h4 = self._dynamics_features(z, action)
|
|
70
|
+
return self.next_obs_predictor(h4)
|
scire/vodm.py
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"""VODM: Variational Observation Density Model.
|
|
2
|
+
|
|
3
|
+
Estimates novelty as the negative log-likelihood of an observation under a
|
|
4
|
+
learned variational autoencoder: log p_theta(x) >= ELBO(x), so
|
|
5
|
+
novelty(x) = -log p_theta(x) <= -ELBO(x) = reconstruction_error + KL divergence.
|
|
6
|
+
Higher values mean the observation is less familiar to the model.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Dict, Optional, Tuple
|
|
10
|
+
|
|
11
|
+
import chex
|
|
12
|
+
import flax.linen as nn
|
|
13
|
+
import jax
|
|
14
|
+
import jax.numpy as jnp
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class VODM(nn.Module):
|
|
18
|
+
"""Variational Observation Density Model used for novelty estimation."""
|
|
19
|
+
|
|
20
|
+
obs_dim: int
|
|
21
|
+
hidden_dim: int = 512
|
|
22
|
+
latent_dim: int = 128
|
|
23
|
+
logvar_min: float = -10.0
|
|
24
|
+
logvar_max: float = 2.0
|
|
25
|
+
|
|
26
|
+
def setup(self):
|
|
27
|
+
self.encoder_1 = nn.Dense(self.hidden_dim)
|
|
28
|
+
self.encoder_2 = nn.Dense(self.hidden_dim)
|
|
29
|
+
self.encoder_3 = nn.Dense(self.hidden_dim)
|
|
30
|
+
self.encoder_4 = nn.Dense(self.hidden_dim)
|
|
31
|
+
self.encoder_norm_1 = nn.LayerNorm()
|
|
32
|
+
self.encoder_norm_2 = nn.LayerNorm()
|
|
33
|
+
self.encoder_norm_3 = nn.LayerNorm()
|
|
34
|
+
self.encoder_norm_4 = nn.LayerNorm()
|
|
35
|
+
|
|
36
|
+
self.mu_layer = nn.Dense(self.latent_dim)
|
|
37
|
+
self.logvar_layer = nn.Dense(self.latent_dim)
|
|
38
|
+
|
|
39
|
+
self.decoder_1 = nn.Dense(self.hidden_dim)
|
|
40
|
+
self.decoder_2 = nn.Dense(self.hidden_dim)
|
|
41
|
+
self.decoder_3 = nn.Dense(self.hidden_dim)
|
|
42
|
+
self.decoder_4 = nn.Dense(self.hidden_dim)
|
|
43
|
+
self.decoder_norm_1 = nn.LayerNorm()
|
|
44
|
+
self.decoder_norm_2 = nn.LayerNorm()
|
|
45
|
+
self.decoder_norm_3 = nn.LayerNorm()
|
|
46
|
+
self.decoder_norm_4 = nn.LayerNorm()
|
|
47
|
+
|
|
48
|
+
self.recon_mu_layer = nn.Dense(self.obs_dim)
|
|
49
|
+
self.recon_logvar_layer = nn.Dense(self.obs_dim)
|
|
50
|
+
|
|
51
|
+
def encode(self, x: chex.Array) -> Tuple[chex.Array, chex.Array]:
|
|
52
|
+
"""Map an observation to the parameters of its approximate posterior q(z|x)."""
|
|
53
|
+
h1 = nn.relu(self.encoder_1(x))
|
|
54
|
+
h1 = self.encoder_norm_1(h1)
|
|
55
|
+
h2 = nn.relu(self.encoder_2(h1))
|
|
56
|
+
h2 = self.encoder_norm_2(h2) + h1
|
|
57
|
+
h3 = nn.relu(self.encoder_3(h2))
|
|
58
|
+
h3 = self.encoder_norm_3(h3) + h2
|
|
59
|
+
h4 = nn.relu(self.encoder_4(h3))
|
|
60
|
+
h4 = self.encoder_norm_4(h4) + h3
|
|
61
|
+
|
|
62
|
+
mu = self.mu_layer(h4)
|
|
63
|
+
logvar = jnp.clip(self.logvar_layer(h4), self.logvar_min, self.logvar_max)
|
|
64
|
+
return mu, logvar
|
|
65
|
+
|
|
66
|
+
def decode(self, z: chex.Array) -> Tuple[chex.Array, chex.Array]:
|
|
67
|
+
"""Map a latent sample to the parameters of the observation model p(x|z)."""
|
|
68
|
+
h1 = nn.relu(self.decoder_1(z))
|
|
69
|
+
h1 = self.decoder_norm_1(h1)
|
|
70
|
+
h2 = nn.relu(self.decoder_2(h1))
|
|
71
|
+
h2 = self.decoder_norm_2(h2) + h1
|
|
72
|
+
h3 = nn.relu(self.decoder_3(h2))
|
|
73
|
+
h3 = self.decoder_norm_3(h3) + h2
|
|
74
|
+
h4 = nn.relu(self.decoder_4(h3))
|
|
75
|
+
h4 = self.decoder_norm_4(h4) + h3
|
|
76
|
+
|
|
77
|
+
recon_mu = self.recon_mu_layer(h4)
|
|
78
|
+
recon_logvar = jnp.clip(self.recon_logvar_layer(h4), self.logvar_min, self.logvar_max)
|
|
79
|
+
return recon_mu, recon_logvar
|
|
80
|
+
|
|
81
|
+
def reparameterize(self, mu: chex.Array, logvar: chex.Array,
|
|
82
|
+
key: Optional[chex.PRNGKey] = None) -> chex.Array:
|
|
83
|
+
"""Sample z ~ q(z|x) via the reparameterization trick (deterministic mean if key is None)."""
|
|
84
|
+
if key is None:
|
|
85
|
+
return mu
|
|
86
|
+
std = jnp.exp(0.5 * logvar)
|
|
87
|
+
eps = jax.random.normal(key, mu.shape)
|
|
88
|
+
return mu + eps * std
|
|
89
|
+
|
|
90
|
+
def compute_negative_elbo(
|
|
91
|
+
self, x: chex.Array, key: Optional[chex.PRNGKey] = None, beta: float = 1.0
|
|
92
|
+
) -> Tuple[chex.Array, Dict[str, chex.Array]]:
|
|
93
|
+
"""Negative ELBO, an upper bound on -log p(x): reconstruction error + beta * KL divergence.
|
|
94
|
+
|
|
95
|
+
Uses a Gaussian (unit-variance) observation model, so `x` may be any
|
|
96
|
+
continuous real-valued observation vector; it does not need to be
|
|
97
|
+
pre-scaled to a particular range such as [0, 1].
|
|
98
|
+
"""
|
|
99
|
+
mu_z, logvar_z = self.encode(x)
|
|
100
|
+
z = self.reparameterize(mu_z, logvar_z, key)
|
|
101
|
+
recon, _ = self.decode(z)
|
|
102
|
+
|
|
103
|
+
recon_loss = jnp.mean((recon - x) ** 2, axis=-1)
|
|
104
|
+
kl_divergence = -0.5 * jnp.mean(1 + logvar_z - mu_z ** 2 - jnp.exp(logvar_z), axis=-1)
|
|
105
|
+
negative_elbo = recon_loss + beta * kl_divergence
|
|
106
|
+
|
|
107
|
+
info = {
|
|
108
|
+
"recon_loss": recon_loss,
|
|
109
|
+
"kl_loss": kl_divergence,
|
|
110
|
+
"negative_elbo": negative_elbo,
|
|
111
|
+
}
|
|
112
|
+
return negative_elbo, info
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: scire
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Seeking Curiosity Intrinsic Reward, and Empowerment.
|
|
5
|
+
Author: Tojoarisoa Rakotoaritina
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Tojoarisoa/scire
|
|
8
|
+
Project-URL: Repository, https://github.com/Tojoarisoa/scire
|
|
9
|
+
Keywords: reinforcement-learning,intrinsic-reward,exploration,jax,empowerment,curiosity,novelty,surprise
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: jax>=0.4.27
|
|
23
|
+
Requires-Dist: jaxlib>=0.4.27
|
|
24
|
+
Requires-Dist: flax>=0.8.0
|
|
25
|
+
Requires-Dist: chex>=0.1.80
|
|
26
|
+
Requires-Dist: numpy
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest; extra == "dev"
|
|
29
|
+
Requires-Dist: build; extra == "dev"
|
|
30
|
+
Requires-Dist: twine; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# SCIRE
|
|
34
|
+
|
|
35
|
+
**S**eeking **C**uriosity **I**ntrinsic **R**eward, and **E**mpowerment.
|
|
36
|
+
|
|
37
|
+
*Scire* is Latin for "to know", fitting for agents driven by curiosity (to know the unknown)
|
|
38
|
+
and empowerment (to know how to control it).
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
scire/__init__.py,sha256=0NoZHVNkR5816BJlc3W4tOz70wFZ8l_iXB5gMdNaDN8,1886
|
|
2
|
+
scire/factory.py,sha256=Dkc5ZYsex_sAgJjCLKkZ511UE_oHMvtkwtkAX-2p6_k,4537
|
|
3
|
+
scire/module.py,sha256=AABX56d-u52pulplF2kUfQpBhZtYY5miLapvx2BhCNU,11115
|
|
4
|
+
scire/normalization.py,sha256=8HFMzeY2Mu2nS168_elGnXMIGGtAEjE5ngImAQATkIU,3945
|
|
5
|
+
scire/vfdm.py,sha256=X8DaNhmfpHtVo0Fmlv2vGrEi8_Ciclgt_OY7axKqxZ0,2793
|
|
6
|
+
scire/vodm.py,sha256=tHYW7SM7LehTPl90O4B_kVdfa90-seWhgDgI32oomEs,4384
|
|
7
|
+
scire-0.1.1.dist-info/licenses/LICENSE,sha256=UF7GWiNOVxelSiqTzQXVZO9TlSaGmCtYtQo2q794xCM,1081
|
|
8
|
+
scire-0.1.1.dist-info/METADATA,sha256=fx5IGXJB07o_i_lGNGzYV4zBWeTnARAVVAjaKZCieH4,1450
|
|
9
|
+
scire-0.1.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
10
|
+
scire-0.1.1.dist-info/top_level.txt,sha256=5KiQKcJP4vVNd8fzwGH-y0EEpUmyNb0JTPfuFACbdME,6
|
|
11
|
+
scire-0.1.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tojoarisoa Rakotoaritina
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
scire
|