---------------------------------------------------------------------------
XlaRuntimeError Traceback (most recent call last)
Cell In[30], line 3
1 joint_prob_graph_cont = graph.joint_prob_graph(indexer, reward_limit=reward_limit, mutation_rate=mutation_rate,
2 discrete=False)
----> 3 svgd = joint_prob_graph_cont.svgd(
4 observations,
5 fixed=[(1, mutation_rate)],
6 n_iterations=100,
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/phasic/__init__.py:6726, in Graph.svgd(self, observed_data, discrete, prior, n_particles, n_iterations, optimizer, learning_rate, bandwidth, theta_init, theta_dim, return_history, seed, verbose, progress, jit, parallel, n_devices, precompile, compilation_config, regularization, nr_moments, positive_params, param_transform, joint_index, rewards, fixed, tied, callback, weight_formula, preconditioner, epoch_starts, daisy_chain_t_eval, daisy_chain_granularity, daisy_chain_probe_theta, daisy_chain_t_eval_tol, final_read, exposure, exposure_param_index, validate_rewards, quiet_assumptions, exact_moment_grad, exact_final_grad, exact_grad)
6722 # path).
6723 if _callback_overridden:
6724 self._weight_callback = _prev_weight_callback
6725 self._weight_mode = _prev_weight_mode
-> 6726 if _formula_overridden:
6727 self._restore_weight_formula_state(*_prev_formula_state)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/phasic/svgd.py:7095, in SVGD.optimize(self, rewards, return_history)
7091 print(f" Nr moments: {self.nr_moments}")
7092 else:
7093 print(f" Moment regularization: disabled")
7094
-> 7095 results = run_svgd(
7096 log_prob_fn=log_prob_fn,
7097 theta_init=self.theta_init,
7098 n_steps=self.n_iterations,
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/phasic/svgd.py:4590, in run_svgd(log_prob_fn, theta_init, n_steps, learning_rate, kernel, return_history, verbose, progress, compiled_grad, parallel_mode, n_devices, log_prob_fn_factory, regularization_schedule, lr_scale, fixed_mask, fixed_values, optimizer, record_log_prob, compiled_value_and_grad)
4586 # Perform SVGD update
4587 if record_log_prob:
4588 # log_p is log_prob_fn at the particles BEFORE this step, i.e.
4589 # at history snapshot `step`
-> 4590 particles, log_p = svgd_step(particles, log_prob_fn, kernel, current_step_size,
4591 parallel_mode=parallel_mode,
4592 n_devices=n_devices,
4593 fixed_mask=fixed_mask,
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/phasic/svgd.py:4311, in svgd_step(particles, log_prob_fn, kernel, step_size, compiled_grad, parallel_mode, n_devices, fixed_mask, fixed_values, optimizer, return_log_prob, compiled_value_and_grad)
4307 log_p = log_p_sharded.reshape(n_particles)
4308 elif actual_parallel_mode == 'vmap':
4309 # Single device vectorization - use vmap only
4310 if return_log_prob:
-> 4311 log_p, grad_log_p = vmap(value_and_grad_to_use)(particles_for_grad)
4312 elif compiled_grad_to_use is not None:
4313 grad_log_p = vmap(compiled_grad_to_use)(particles_for_grad)
4314 else:
[... skipping hidden 7 frame]
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/phasic/svgd.py:4256, in svgd_step.<locals>.compiled_value_and_grad_reduced(theta_learnable)
4252 theta_full = jnp.array(fixed_values) # Create fresh copy
4253 else:
4254 theta_full = jnp.ones(len(fixed_mask))
4255 theta_full = theta_full.at[learnable_indices].set(theta_learnable)
-> 4256 value, grad_full = compiled_value_and_grad(theta_full)
4257 return value, grad_full[learnable_indices]
[... skipping hidden 16 frame]
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/interpreters/pxla.py:1372, in ExecuteReplicated.__call__(self, *args)
1369 if (self.ordered_effects or self.has_unordered_effects
1370 or self.has_host_callbacks):
1371 input_bufs = self._add_tokens_to_inputs(input_bufs)
-> 1372 results = self.xla_executable.execute_sharded(input_bufs, with_tokens=True)
1374 result_token_bufs = results.disassemble_prefix_into_single_device_arrays(
1375 len(self.ordered_effects))
1376 sharded_runtime_token = results.consume_token()
XlaRuntimeError: INVALID_ARGUMENT: DaisyChainSojournFfiImpl: theta produced a NEGATIVE transition rate (most negative edge weight: -0.000000). A rate cannot be negative -- the solver's output would not be a probability distribution. Under 'linear' weights this means some theta component went below zero.