---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
Cell In[31], line 1
----> 1 svgd = graph.svgd(observed_data,
2 prior=prior,
3 learning_rate=step_schedule,
4 regularization=reg_schedule,
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/phasic/__init__.py:6826, 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)
6822 # path).
6823 if _callback_overridden:
6824 self._weight_callback = _prev_weight_callback
6825 self._weight_mode = _prev_weight_mode
-> 6826 if _formula_overridden:
6827 self._restore_weight_formula_state(*_prev_formula_state)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/phasic/svgd.py:6855, in SVGD.optimize(self, rewards, return_history)
6851 regularization=reg_value,
6852 rewards=rewards
6853 )
6854
-> 6855 results = run_svgd(
6856 log_prob_fn=None, # Created dynamically per iteration
6857 theta_init=self.theta_init,
6858 n_steps=self.n_iterations,
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/phasic/svgd.py:4457, 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)
4453 else:
4454 compiled_grad_to_use = compiled_grad
4455
4456 # Perform SVGD update
-> 4457 particles = svgd_step(particles, log_prob_fn, kernel, current_step_size,
4458 compiled_grad=compiled_grad_to_use,
4459 parallel_mode=parallel_mode,
4460 n_devices=n_devices,
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/phasic/svgd.py:4217, in svgd_step(particles, log_prob_fn, kernel, step_size, compiled_grad, parallel_mode, n_devices, fixed_mask, fixed_values, optimizer)
4213 # Single device vectorization - use vmap only
4214 if compiled_grad_to_use is not None:
4215 grad_log_p = vmap(compiled_grad_to_use)(particles_for_grad)
4216 else:
-> 4217 grad_log_p = vmap(grad(log_prob_for_grad))(particles_for_grad)
4218 elif actual_parallel_mode == 'none':
4219 # No parallelization - sequential computation (useful for debugging)
4220 if compiled_grad_to_use is not None:
[... skipping hidden 1 frame]
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/api.py:1114, in vmap.<locals>.vmap_f(*args, **kwargs)
1111 try:
1112 axis_data = batching.AxisData(axis_name, axis_size_, spmd_axis_name,
1113 explicit_mesh_axis)
-> 1114 out_flat = batching.batch(
1115 flat_fun, axis_data, in_axes_flat,
1116 lambda: flatten_axes("vmap out_axes", out_tree(), out_axes)
1117 ).call_wrapped(*args_flat)
1118 except batching.SpecMatchError as e:
1119 out_axes_flat = flatten_axes("vmap out_axes", out_tree(), out_axes)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/linear_util.py:212, in WrappedFun.call_wrapped(self, *args, **kwargs)
210 def call_wrapped(self, *args, **kwargs):
211 """Calls the transformed function"""
--> 212 return self.f_transformed(*args, **kwargs)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/interpreters/batching.py:644, in _batch_outer(f, axis_data, in_dims, *in_vals)
642 tag = TraceTag()
643 with source_info_util.transform_name_stack('vmap'):
--> 644 outs, trace = f(tag, in_dims, *in_vals)
645 with core.ensure_no_leaks(trace): del trace
646 return outs
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/interpreters/batching.py:660, in _batch_inner(f, axis_data, out_dim_dests, tag, in_dims, *in_vals)
656 in_tracers = map(partial(to_elt, trace, idx), in_vals, in_dims)
657 with (core.set_current_trace(trace),
658 core.extend_axis_env_nd([(axis_data.name, axis_data.size)]),
659 core.add_spmd_axis_names(axis_data.spmd_name)):
--> 660 outs = f(*in_tracers)
661 out_dim_dests = out_dim_dests() if callable(out_dim_dests) else out_dim_dests
662 out_vals = map(partial(from_elt, trace, axis_data.size, axis_data.explicit_mesh_axis),
663 range(len(outs)), outs, out_dim_dests)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/interpreters/batching.py:342, in flatten_fun_for_vmap(f, store, in_tree, *args_flat)
338 @lu.transformation_with_aux2
339 def flatten_fun_for_vmap(f: Callable,
340 store: lu.Store, in_tree: PyTreeDef, *args_flat):
341 py_args, py_kwargs = tree_unflatten(in_tree, args_flat)
--> 342 ans = f(*py_args, **py_kwargs)
343 ans, out_tree = tree_flatten(ans, is_leaf=is_vmappable)
344 store.store(out_tree)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/linear_util.py:429, in _get_result_paths_thunk(_fun, _store, *args, **kwargs)
427 @transformation_with_aux2
428 def _get_result_paths_thunk(_fun: Callable, _store: Store, *args, **kwargs):
--> 429 ans = _fun(*args, **kwargs)
430 result_paths = tuple(f"result{_clean_keystr_arg_names(path)}" for path, _ in generate_key_paths(ans))
431 if _store:
432 # In some instances a lu.WrappedFun is called multiple times, e.g.,
433 # the bwd function in a custom_vjp
[... skipping hidden 1 frame]
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/api.py:405, in grad.<locals>.grad_f(*args, **kwargs)
402 @wraps(fun, docstr=docstr, argnums=argnums)
403 @api_boundary
404 def grad_f(*args, **kwargs):
--> 405 _, g = value_and_grad_f(*args, **kwargs)
406 return g
[... skipping hidden 1 frame]
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/api.py:478, in value_and_grad.<locals>.value_and_grad_f(*args, **kwargs)
476 _check_input_dtype_grad(holomorphic, allow_int, leaf)
477 if not has_aux:
--> 478 ans, vjp_py = _vjp(f_partial, *dyn_args)
479 else:
480 ans, vjp_py, aux = _vjp(f_partial, *dyn_args, has_aux=True)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/api.py:2134, in _vjp(fun, has_aux, *primals)
2132 if not has_aux:
2133 flat_fun, out_tree = flatten_fun_nokwargs(fun, in_tree)
-> 2134 out_primals, vjp = ad.vjp(flat_fun, primals_flat)
2135 out_tree = out_tree()
2136 else:
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/interpreters/ad.py:313, in vjp(traceable, primals, has_aux)
311 def vjp(traceable: lu.WrappedFun, primals, has_aux=False):
312 if not has_aux:
--> 313 out_primals, pvals, jaxpr, consts = linearize(traceable, *primals)
314 else:
315 out_primals, pvals, jaxpr, consts, aux = linearize(traceable, *primals, has_aux=True)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/interpreters/ad.py:287, in linearize(traceable, *primals, **kwargs)
285 has_aux = kwargs.pop('has_aux', False)
286 if config.use_direct_linearize.value:
--> 287 return direct_linearize(traceable, primals, kwargs, has_aux=has_aux)
288 if not has_aux:
289 jvpfun = jvp(traceable)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/interpreters/ad.py:261, in direct_linearize(traceable, primals, kwargs, has_aux, tag)
256 aux_primals = [x.primal
257 if isinstance(x, LinearizeTracer)
258 and x._trace.tag is linearize_trace.tag
259 else x for x in aux]
260 else:
--> 261 ans = traceable.call_wrapped(*tracers)
262 aux = None
263 out_primals, out_tangents = unzip2(map(linearize_trace.to_primal_tangent_pair, ans))
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/linear_util.py:212, in WrappedFun.call_wrapped(self, *args, **kwargs)
210 def call_wrapped(self, *args, **kwargs):
211 """Calls the transformed function"""
--> 212 return self.f_transformed(*args, **kwargs)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/api_util.py:90, in flatten_fun_nokwargs(f, store, in_tree, *args_flat)
86 @lu.transformation_with_aux2
87 def flatten_fun_nokwargs(f: Callable, store: lu.Store,
88 in_tree: PyTreeDef, *args_flat):
89 py_args = tree_unflatten(in_tree, args_flat)
---> 90 ans = f(*py_args)
91 ans, out_tree = tree_flatten(ans)
92 store.store(out_tree)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/api_util.py:292, in _argnums_partial(_fun, _dyn_argnums, _fixed_args, *dyn_args, **kwargs)
290 args = [next(fixed_args_).val if x is sentinel else x for x in args]
291 assert next(fixed_args_, sentinel) is sentinel
--> 292 return _fun(*args, **kwargs)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/linear_util.py:429, in _get_result_paths_thunk(_fun, _store, *args, **kwargs)
427 @transformation_with_aux2
428 def _get_result_paths_thunk(_fun: Callable, _store: Store, *args, **kwargs):
--> 429 ans = _fun(*args, **kwargs)
430 result_paths = tuple(f"result{_clean_keystr_arg_names(path)}" for path, _ in generate_key_paths(ans))
431 if _store:
432 # In some instances a lu.WrappedFun is called multiple times, e.g.,
433 # the bwd function in a custom_vjp
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/phasic/svgd.py:6274, in SVGD._log_prob_unified(self, theta, nr_moments, sample_moments, regularization, rewards)
6270
6271 # Evaluate model
6272 try:
6273 result = self.model(theta_transformed, self.observed_data, rewards=rewards)
-> 6274 except Exception as e:
6275 raise ValueError(
6276 f"Model evaluation failed. Ensure model has signature model(theta, times, rewards=None). "
6277 f"Error: {e}"
[... skipping hidden 1 frame]
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/custom_derivatives.py:747, in custom_vjp.__call__(self, *args, **kwargs)
743 flat_fwd, out_trees = _flatten_fwd(
744 fwd_, self.nondiff_argnums, self.symbolic_zeros, debug_fun,
745 debug_fwd, in_tree, out_type)
746 flat_bwd = _flatten_bwd(bwd, in_tree, in_avals, out_trees)
--> 747 out_flat = custom_vjp_call_p.bind(flat_fun, flat_fwd, flat_bwd,
748 *args_flat, out_trees=out_trees,
749 symbolic_zeros=self.symbolic_zeros)
750 _, (out_tree, _, _) = lu.merge_linear_aux(out_type, out_trees)
751 return tree_unflatten(out_tree, out_flat)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/custom_derivatives.py:999, in CustomVJPCallPrimitive.bind(self, *args, **params)
998 def bind(self, *args, **params):
--> 999 return self._true_bind(*args, **params)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/core.py:650, in Primitive._true_bind(self, *args, **params)
648 trace_ctx.set_trace(eval_trace)
649 try:
--> 650 return self.bind_with_trace(prev_trace, args, params)
651 finally:
652 trace_ctx.set_trace(prev_trace)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/custom_derivatives.py:1003, in CustomVJPCallPrimitive.bind_with_trace(self, trace, args, params)
1001 def bind_with_trace(self, trace, args, params):
1002 fun, fwd, bwd, tracers = args[0], args[1], args[2], args[3:]
-> 1003 return trace.process_custom_vjp_call(self, fun, fwd, bwd, tracers, **params)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/interpreters/ad.py:955, in LinearizeTrace.process_custom_vjp_call(self, prim, fun, fwd, bwd, tracers, out_trees, symbolic_zeros)
953 fwd_in_flat = [x for pair in fwd_in for x in pair] # flatten
954 with core.set_current_trace(self.parent_trace):
--> 955 res_and_primals_out = fwd.call_wrapped(*fwd_in_flat)
957 _, res_tree, input_fwds = out_trees()
958 num_res_out = res_tree.num_leaves - sum(f is not None for f in input_fwds)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/linear_util.py:212, in WrappedFun.call_wrapped(self, *args, **kwargs)
210 def call_wrapped(self, *args, **kwargs):
211 """Calls the transformed function"""
--> 212 return self.f_transformed(*args, **kwargs)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/custom_derivatives.py:848, in _flatten_fwd(f, store, nondiff_argnums, symbolic_zeros, debug_primal, debug_fwd, in_tree, maybe_out_type, *args)
846 if config.mutable_array_checks.value:
847 _check_for_aliased_refs(f, nondiff_argnums, debug_primal, py_args)
--> 848 pair_out = f(*py_args)
849 if not isinstance(pair_out, (list, tuple)) or len(pair_out) != 2:
850 msg = (f"Custom VJP fwd rule {fwd_name} for function {primal_name} "
851 "must produce a pair (list or tuple of length two) where the first "
852 "element represents the primal output (equal to those of the "
(...) 855 "forward pass for use on the backward pass), but "
856 f"instead of a pair the fwd rule {fwd_name} produced {pair_out}.")
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/linear_util.py:429, in _get_result_paths_thunk(_fun, _store, *args, **kwargs)
427 @transformation_with_aux2
428 def _get_result_paths_thunk(_fun: Callable, _store: Store, *args, **kwargs):
--> 429 ans = _fun(*args, **kwargs)
430 result_paths = tuple(f"result{_clean_keystr_arg_names(path)}" for path, _ in generate_key_paths(ans))
431 if _store:
432 # In some instances a lu.WrappedFun is called multiple times, e.g.,
433 # the bwd function in a custom_vjp
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/phasic/__init__.py:8424, in Graph.pmf_and_moments_from_graph.<locals>.model_fwd(theta, times, rewards)
8422 def model_fwd(theta, times, rewards=None):
8423 # Call the underlying computation, not model (avoid infinite recursion!)
-> 8424 pmf, moments = _compute_pure(theta, times, rewards)
8425 return (pmf, moments), (theta, times, rewards)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/phasic/__init__.py:8284, in Graph.pmf_and_moments_from_graph.<locals>._compute_pure(theta, times, rewards)
8280 rewards_np = None
8281
8282 return _compute_pmf_and_moments_cached(theta_np, times_np, rewards_np)
8283
-> 8284 result = jax.pure_callback(
8285 callback_fn,
8286 (pmf_shape, moments_shape),
8287 theta, times, rewards_jax, # Pass all args to allow vmap
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/callback.py:388, in pure_callback(callback, result_shape_dtypes, sharding, vectorized, vmap_method, *args, **kwargs)
385 result_avals = tree_util.tree_map(
386 lambda x: core.ShapedArray(x.shape, x.dtype), result_shape_dtypes)
387 flat_result_avals, out_tree = tree_util.tree_flatten(result_avals)
--> 388 out_flat = pure_callback_p.bind(
389 *flat_args,
390 callback=_FlatCallback(callback, in_tree),
391 result_avals=tuple(flat_result_avals),
392 sharding=sharding,
393 vmap_method=vmap_method,
394 )
395 return tree_util.tree_unflatten(out_tree, out_flat)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/core.py:634, in Primitive.bind(self, *args, **params)
632 def bind(self, *args, **params):
633 args = args if self.skip_canonicalization else map(canonicalize_value, args)
--> 634 return self._true_bind(*args, **params)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/core.py:650, in Primitive._true_bind(self, *args, **params)
648 trace_ctx.set_trace(eval_trace)
649 try:
--> 650 return self.bind_with_trace(prev_trace, args, params)
651 finally:
652 trace_ctx.set_trace(prev_trace)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/core.py:662, in Primitive.bind_with_trace(self, trace, args, params)
660 with set_current_trace(trace):
661 return self.to_lojax(*args, **params) # type: ignore
--> 662 return trace.process_primitive(self, args, params)
663 trace.process_primitive(self, args, params) # may raise lojax error
664 raise Exception(f"couldn't apply typeof to args: {args}")
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/interpreters/batching.py:531, in BatchTrace.process_primitive(self, p, tracers, params)
529 elif p in primitive_batchers:
530 with core.set_current_trace(self.parent_trace):
--> 531 val_out, dim_out = primitive_batchers[p](vals_in, dims_in, **params)
532 else:
533 raise NotImplementedError(f"Batching rule for '{p}' not implemented")
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/ffi.py:704, in ffi_batching_rule(prim, args, dims, vmap_method, result_avals, **kwargs)
700 if kwargs.get("input_layouts") is not None:
701 kwargs["input_layouts"] = tuple(
702 None if layout is None else tuple(n + 1 for n in layout) + (0,)
703 for layout in kwargs["input_layouts"])
--> 704 outvals = prim.bind(
705 *bcast_args,
706 vmap_method=vmap_method,
707 result_avals=batched_result_avals,
708 **kwargs,
709 )
710 elif vmap_method == "sequential" or vmap_method == "sequential_unrolled":
711 is_batched = [d is not batching.not_mapped for d in dims]
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/core.py:634, in Primitive.bind(self, *args, **params)
632 def bind(self, *args, **params):
633 args = args if self.skip_canonicalization else map(canonicalize_value, args)
--> 634 return self._true_bind(*args, **params)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/core.py:650, in Primitive._true_bind(self, *args, **params)
648 trace_ctx.set_trace(eval_trace)
649 try:
--> 650 return self.bind_with_trace(prev_trace, args, params)
651 finally:
652 trace_ctx.set_trace(prev_trace)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/core.py:662, in Primitive.bind_with_trace(self, trace, args, params)
660 with set_current_trace(trace):
661 return self.to_lojax(*args, **params) # type: ignore
--> 662 return trace.process_primitive(self, args, params)
663 trace.process_primitive(self, args, params) # may raise lojax error
664 raise Exception(f"couldn't apply typeof to args: {args}")
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/core.py:1189, in EvalTrace.process_primitive(self, primitive, args, params)
1187 args = map(full_lower, args)
1188 check_eval_args(args)
-> 1189 return primitive.impl(*args, **params)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/dispatch.py:90, in apply_primitive(prim, *args, **params)
88 prev = lib.jax_jit.swap_thread_local_state_disable_jit(False)
89 try:
---> 90 outs = fun(*args)
91 finally:
92 lib.jax_jit.swap_thread_local_state_disable_jit(prev)
[... skipping hidden 1 frame]
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/pjit.py:268, in _cpp_pjit.<locals>.cache_miss(*args, **kwargs)
263 if config.no_tracing.value:
264 raise RuntimeError(f"re-tracing function {jit_info.fun_sourceinfo} for "
265 "`jit`, but 'no_tracing' is set")
267 (outs, out_flat, out_tree, args_flat, jaxpr,
--> 268 executable, pgle_profiler, const_args) = _python_pjit_helper(
269 fun, jit_info, *args, **kwargs)
271 maybe_fastpath_data = _get_fastpath_data(
272 executable, out_tree, args_flat, out_flat, jaxpr.effects, jaxpr.consts,
273 jit_info.abstracted_axes, pgle_profiler,
274 const_args)
276 return outs, maybe_fastpath_data, _need_to_rebuild_with_fdo(pgle_profiler)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/pjit.py:150, in _python_pjit_helper(fun, jit_info, *args, **kwargs)
147 out_flat, compiled, profiler, const_args = _pjit_call_impl_python(
148 *args_flat, **p.params)
149 else:
--> 150 out_flat = jit_p.bind(*args_flat, **p.params)
151 compiled = None
152 profiler = None
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/core.py:634, in Primitive.bind(self, *args, **params)
632 def bind(self, *args, **params):
633 args = args if self.skip_canonicalization else map(canonicalize_value, args)
--> 634 return self._true_bind(*args, **params)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/core.py:650, in Primitive._true_bind(self, *args, **params)
648 trace_ctx.set_trace(eval_trace)
649 try:
--> 650 return self.bind_with_trace(prev_trace, args, params)
651 finally:
652 trace_ctx.set_trace(prev_trace)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/core.py:662, in Primitive.bind_with_trace(self, trace, args, params)
660 with set_current_trace(trace):
661 return self.to_lojax(*args, **params) # type: ignore
--> 662 return trace.process_primitive(self, args, params)
663 trace.process_primitive(self, args, params) # may raise lojax error
664 raise Exception(f"couldn't apply typeof to args: {args}")
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/core.py:1189, in EvalTrace.process_primitive(self, primitive, args, params)
1187 args = map(full_lower, args)
1188 check_eval_args(args)
-> 1189 return primitive.impl(*args, **params)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/pjit.py:1829, in _pjit_call_impl(jaxpr, in_shardings, out_shardings, in_layouts, out_layouts, donated_invars, ctx_mesh, name, keep_unused, inline, compiler_options_kvs, *args)
1821 donated_argnums = tuple(i for i, d in enumerate(donated_invars) if d)
1822 cache_key = pxla.JitGlobalCppCacheKeys(
1823 donate_argnums=donated_argnums, donate_argnames=None,
1824 device=None, backend=None,
(...) 1827 in_layouts_treedef=None, in_layouts_leaves=in_layouts,
1828 out_layouts_treedef=None, out_layouts_leaves=out_layouts)
-> 1829 return xc._xla.pjit(
1830 name, f, call_impl_cache_miss, [], [], cache_key,
1831 tree_util.dispatch_registry, pxla.cc_shard_arg,
1832 _get_cpp_global_cache(cache_key.contains_explicit_attributes))(*args)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/pjit.py:1805, in _pjit_call_impl.<locals>.call_impl_cache_miss(*args_, **kwargs_)
1801 def call_impl_cache_miss(*args_, **kwargs_):
1802 # args_ do not include the const args
1803 # See https://docs.jax.dev/en/latest/internals/constants.html.
1804 # TODO(necula): remove num_const_args when fixing the C++ path
-> 1805 out_flat, compiled, pgle_profiler, const_args = _pjit_call_impl_python(
1806 *args, jaxpr=jaxpr, in_shardings=in_shardings,
1807 out_shardings=out_shardings, in_layouts=in_layouts,
1808 out_layouts=out_layouts, donated_invars=donated_invars,
1809 ctx_mesh=ctx_mesh, name=name, keep_unused=keep_unused,
1810 inline=inline, compiler_options_kvs=compiler_options_kvs)
1811 fastpath_data = _get_fastpath_data(
1812 compiled, tree_structure(out_flat), args, out_flat,
1813 jaxpr.effects, jaxpr.consts, None, pgle_profiler,
1814 const_args)
1815 return out_flat, fastpath_data, _need_to_rebuild_with_fdo(pgle_profiler)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/pjit.py:1758, in _pjit_call_impl_python(jaxpr, in_shardings, out_shardings, in_layouts, out_layouts, donated_invars, ctx_mesh, name, keep_unused, inline, compiler_options_kvs, *args)
1746 # Passing mutable PGLE profile here since it should be extracted by JAXPR to
1747 # initialize the fdo_profile compile option.
1748 computation = _resolve_and_lower(
1749 args, jaxpr=jaxpr, in_shardings=in_shardings,
1750 out_shardings=out_shardings, in_layouts=in_layouts,
(...) 1756 compiler_options_kvs=compiler_options_kvs,
1757 )
-> 1758 compiled = computation.compile()
1760 # This check is expensive so only do it if enable_checks is on.
1761 if compiled._auto_spmd_lowering and config.enable_checks.value:
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/interpreters/pxla.py:2537, in MeshComputation.compile(self, compiler_options, device_assignment)
2534 assert isinstance(compilation_device_list, (type(None), xc.DeviceList))
2536 if self._executable is None or compiler_options_kvs or device_assignment:
-> 2537 executable = UnloadedMeshExecutable.from_hlo(
2538 self._name, self._hlo, **self.compile_args,
2539 compiler_options_kvs=compiler_options_kvs,
2540 device_list=compilation_device_list)
2541 if not compiler_options_kvs:
2542 self._executable = executable
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/interpreters/pxla.py:3083, in UnloadedMeshExecutable.from_hlo(***failed resolving arguments***)
3080 break
3082 util.test_event("pxla_cached_compilation")
-> 3083 xla_executable = _cached_compilation(
3084 hlo, name, mesh, spmd_lowering,
3085 tuple_args, auto_spmd_lowering, allow_prop_to_inputs,
3086 allow_prop_to_outputs, tuple(host_callbacks), backend, device_list,
3087 pmap_nreps, compiler_options_kvs, pgle_profiler)
3089 if auto_spmd_lowering:
3090 assert mesh is not None
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/interpreters/pxla.py:2864, in _cached_compilation(computation, name, mesh, spmd_lowering, tuple_args, auto_spmd_lowering, allow_prop_to_inputs, allow_prop_to_outputs, host_callbacks, backend, da, pmap_nreps, compiler_options_kvs, pgle_profiler)
2856 compile_options = create_compile_options(
2857 computation, mesh, spmd_lowering, tuple_args, auto_spmd_lowering,
2858 allow_prop_to_inputs, allow_prop_to_outputs, backend,
2859 dev, pmap_nreps, compiler_options)
2861 with dispatch.log_elapsed_time(
2862 "Finished XLA compilation of {fun_name} in {elapsed_time:.9f} sec",
2863 fun_name=name, event=dispatch.BACKEND_COMPILE_EVENT):
-> 2864 xla_executable = compiler.compile_or_get_cached(
2865 backend, computation, dev, compile_options, host_callbacks,
2866 da, pgle_profiler)
2867 return xla_executable
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/compiler.py:494, in compile_or_get_cached(backend, computation, devices, compile_options, host_callbacks, executable_devices, pgle_profiler)
492 else:
493 log_persistent_cache_miss(module_name, cache_key)
--> 494 return _compile_and_write_cache(
495 backend,
496 computation,
497 executable_devices,
498 compile_options,
499 host_callbacks,
500 module_name,
501 cache_key,
502 )
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/compiler.py:762, in _compile_and_write_cache(backend, computation, executable_devices, compile_options, host_callbacks, module_name, cache_key)
752 def _compile_and_write_cache(
753 backend: xc.Client,
754 computation: ir.Module,
(...) 759 cache_key: str,
760 ) -> xc.LoadedExecutable:
761 start_time = time.monotonic()
--> 762 executable = backend_compile_and_load(
763 backend, computation, executable_devices, compile_options, host_callbacks
764 )
765 compile_time = time.monotonic() - start_time
766 _cache_write(
767 cache_key, compile_time, module_name, backend, executable, host_callbacks
768 )
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/profiler.py:364, in annotate_function.<locals>.wrapper(*args, **kwargs)
361 @wraps(func)
362 def wrapper(*args, **kwargs):
363 with TraceAnnotation(name, **decorator_kwargs):
--> 364 return func(*args, **kwargs)
File ~/phasic/.pixi/envs/default/lib/python3.13/site-packages/jax/_src/compiler.py:369, in backend_compile_and_load(backend, module, executable_devices, options, host_callbacks)
367 else:
368 if host_callbacks:
--> 369 return backend.compile_and_load(
370 built_c,
371 executable_devices=executable_devices,
372 compile_options=options,
373 host_callbacks=host_callbacks,
374 )
375 # Some backends don't have `host_callbacks` option yet
376 # TODO(sharadmv): remove this fallback when all backends allow `compile`
377 # to take in `host_callbacks`
378 return backend.compile_and_load(
379 built_c,
380 executable_devices=executable_devices,
381 compile_options=options,
382 )
KeyboardInterrupt: