3f196bcdd1e0310208e8978cf4f1fb590614568b,utils.py,,load_model,#,15
Before Change
return os.path.join(storage_dir(), "models", model_name+".pt")
def load_model(observation_space, action_space, from_path):
if from_path == None or not(os.path.exists(from_path)):
policy_net = Policy(observation_space, action_space)
value_net = Value(observation_space)
else:
policy_net, value_net = pickle.load(open(from_path, "rb"))
if ac_rl.use_gpu:
policy_net = policy_net.cuda()
value_net = value_net.cuda()
After Change
def load_model(observation_space, action_space, from_path):
acmodel = ACModel(observation_space, action_space)
if from_path != None and os.path.exists(from_path):
acmodel.load_state_dict(torch.load(from_path))
return acmodel
def save_model(acmodel, to_path):
dirname = os.path.dirname(to_path)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: lcswillems/torch-rl
Commit Name: 3f196bcdd1e0310208e8978cf4f1fb590614568b
Time: 2018-04-15
Author: lcswillems@gmail.com
File Name: utils.py
Class Name:
Method Name: load_model
Project Name: explosion/thinc
Commit Name: cc53003029d11839c394a9544a1394b62721869d
Time: 2019-10-18
Author: honnibal+gh@gmail.com
File Name: thinc/extra/wrappers.py
Class Name: PyTorchWrapper
Method Name: use_params
Project Name: leftthomas/SRGAN
Commit Name: 9a936c946174094bef05ed2fc9a4c44adb841c05
Time: 2018-01-15
Author: leftthomas@qq.com
File Name: test_image.py
Class Name:
Method Name: