MCPcopy Create free account
hub / github.com/OpenDriveLab/TCP / load

Method load

roach/models/ppo_policy.py:222–234  ·  view source on GitHub ↗
(cls, path)

Source from the content-addressed store, hash-verified

220
221 @classmethod
222 def load(cls, path):
223 if th.cuda.is_available():
224 device = 'cuda'
225 else:
226 device = 'cpu'
227 saved_variables = th.load(path, map_location=device)
228 # Create policy object
229 model = cls(**saved_variables['policy_init_kwargs'])
230
231 # Load weights
232 model.load_state_dict(saved_variables['policy_state_dict'])
233 model.to(device)
234 return model, saved_variables['train_init_kwargs']
235
236 @staticmethod
237 def init_weights(module: nn.Module, gain: float = 1) -> None:

Callers 13

statistics.pyFile · 0.80
filter_data.pyFile · 0.80
gen_single_routeFunction · 0.80
__init__Method · 0.80
fetch_dictFunction · 0.80
prettify_jsonFunction · 0.80
setupMethod · 0.80
setupMethod · 0.80
_load_weightMethod · 0.80
__init__Method · 0.80
_get_criteriaMethod · 0.80
setupMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected