MCPcopy Create free account
hub / github.com/Physical-Intelligence/openpi / load

Method load

src/openpi/models/model.py:233–241  ·  view source on GitHub ↗

Create a model with the given parameters.

(self, params: at.Params, *, remove_extra_params: bool = True)

Source from the content-addressed store, hash-verified

231 """Create a new model, initializing parameters."""
232
233 def load(self, params: at.Params, *, remove_extra_params: bool = True) -> "BaseModel":
234 """Create a model with the given parameters."""
235 model = nnx.eval_shape(self.create, jax.random.key(0))
236 graphdef, state = nnx.split(model)
237 if remove_extra_params:
238 params = ocp.transform_utils.intersect_trees(state.to_pure_dict(), params)
239 at.check_pytree_equality(expected=state.to_pure_dict(), got=params, check_shapes=True, check_dtypes=False)
240 state.replace_by_pure_dict(params)
241 return nnx.merge(graphdef, state)
242
243 def load_pytorch(self, train_config, weight_path: str):
244 logger.info(f"train_config: {train_config}")

Callers 7

create_trained_policyFunction · 0.45
test_model_restoreFunction · 0.45
load_checkpointFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls

no outgoing calls

Tested by 1

test_model_restoreFunction · 0.36