MCPcopy
hub / github.com/msracver/Deformable-ConvNets / load

Method load

faster_rcnn/core/module.py:109–145  ·  view source on GitHub ↗

Create a model from previously saved checkpoint. Parameters ---------- prefix : str path prefix of saved model files. You should have "prefix-symbol.json", "prefix-xxxx.params", and optionally "prefix-xxxx.states", where xxxx is the

(prefix, epoch, load_optimizer_states=False, **kwargs)

Source from the content-addressed store, hash-verified

107
108 @staticmethod
109 def load(prefix, epoch, load_optimizer_states=False, **kwargs):
110 """Create a model from previously saved checkpoint.
111
112 Parameters
113 ----------
114 prefix : str
115 path prefix of saved model files. You should have
116 "prefix-symbol.json", "prefix-xxxx.params", and
117 optionally "prefix-xxxx.states", where xxxx is the
118 epoch number.
119 epoch : int
120 epoch to load.
121 load_optimizer_states : bool
122 whether to load optimizer states. Checkpoint needs
123 to have been made with save_optimizer_states=True.
124 data_names : list of str
125 Default is `('data')` for a typical model used in image classification.
126 label_names : list of str
127 Default is `('softmax_label')` for a typical model used in image
128 classification.
129 logger : Logger
130 Default is `logging`.
131 context : Context or list of Context
132 Default is `cpu()`.
133 work_load_list : list of number
134 Default `None`, indicating uniform workload.
135 fixed_param_names: list of str
136 Default `None`, indicating no network parameters are fixed.
137 """
138 sym, args, auxs = load_checkpoint(prefix, epoch)
139 mod = Module(symbol=sym, **kwargs)
140 mod._arg_params = args
141 mod._aux_params = auxs
142 mod.params_initialized = True
143 if load_optimizer_states:
144 mod._preload_opt_states = '%s-%04d.states'%(prefix, epoch)
145 return mod
146
147 def save_checkpoint(self, prefix, epoch, save_optimizer_states=False):
148 """Save current progress to checkpoint.

Callers 2

pred_evalFunction · 0.45
update_configFunction · 0.45

Calls 2

load_checkpointFunction · 0.90
ModuleClass · 0.70

Tested by 1

pred_evalFunction · 0.36