code
stringlengths
3
6.57k
module_state_dict()
os.path.join(save_dir, tag)
self.module_state_dict()
self.optimizer.state_dict()
self.zero_optimization()
self.lr_scheduler.state_dict()
state.update(client_state)
log_dist(message=f'Saving model checkpoint: {save_path}', ranks=[0])
logger.info('Saving model checkpoint: {}'.format(save_path)
torch.save(state, save_path)
_get_param_shapes(self)
OrderedDict()
self.module.named_parameters()
print(f"saving param {name} {param_shapes[name]}")
_copy_recovery_script(self, save_path)
os.path.dirname(os.path.dirname(__file__)
os.path.join(base_dir, "utils", script)
os.path.join(save_path, script)
logger.info(f"creating recovery script {dst}")
copyfile(src, dst)
os.chmod(dst, os.stat(dst)
_save_zero_checkpoint(self, save_path, tag)
self._get_zero_ckpt_name(save_path, tag)
self.optimizer.state_dict()
self._get_param_shapes()
torch.save(zero_sd, zero_checkpoint_name)
self._copy_recovery_script(save_path)
logger.info('zero checkpoint saved {}'.format(zero_checkpoint_name)
_zero3_consolidated_fp16_state_dict(self)
nn.Module.state_dict (modelled after _save_to_state_dict)
self.zero_optimization_partition_weights()
ValueError("this function requires ZeRO-3 mode")
OrderedDict()
torch.distributed.get_rank()
get_layer_state_dict(module, prefix="")
module.parameters(recurse=False)
torch.distributed.get_rank()
module.named_parameters(recurse=False)
param.storage()
data_ptr()
print(f"`{key}` is shared with `{shared_weights[data_ptr_id]}`")
param.detach()
cpu()
print(f"param {name} {param.shape}")
print(f"param {key} {param.shape} {state_dict[key].storage()
data_ptr()
module.named_buffers(recurse=False)
buf.detach()
cpu()
module.named_children()
get_layer_state_dict(child, prefix + name + ".")
see_memory_usage("before get_layer_state_dict", force=False)
get_layer_state_dict(self.module, prefix="")
see_memory_usage("after get_layer_state_dict", force=False)
save_fp16_model(self, save_dir, save_filename="pytorch_model.bin")
os.path.join(save_dir, save_filename)
self.zero_optimization_partition_weights()
self.zero_gather_fp16_weights_on_model_save()
self._zero3_consolidated_fp16_state_dict()
self.module.state_dict()
torch.distributed.get_rank()
os.makedirs(save_dir, exist_ok=True)
logger.info(f"Saving model weights to {path}")
torch.save(state_dict, path)
np.random.RandomState(323)
sr.StatsRecorder()
np.empty((0, ndims)
range(1000)
rs.randint(10,101)
rs.randn(nobserv, ndims)
np.vstack((data, newdata)
mystats.update(newdata)
np.allclose(mystats.mean, data.mean(axis=0)
np.allclose(mystats.std, data.std(axis=0)
InsertPrimitiveDialog(QtWidgets.QWidget)
__init__(self, primitive, parent)
super()
__init__(parent)
self.parent.scenes.switchToSampleScene()
QtWidgets.QVBoxLayout()
self.parent_model.uniqueKey(self.primitive.value)
self.mesh_args.update({'outer_radius': 100.000, 'inner_radius': 50.000, 'height': 200.000})
self.mesh_args.update({'radius': 100.000})
self.mesh_args.update({'radius': 100.000, 'height': 200.000})
self.mesh_args.update({'width': 50.000, 'height': 100.000, 'depth': 200.000})
self.createPrimitiveSwitcher()
self.createFormInputs()
QtWidgets.QHBoxLayout()
QtWidgets.QPushButton('Create')
self.create_primitive_button.clicked.connect(self.createPrimiviteButtonClicked)
button_layout.addWidget(self.create_primitive_button)
button_layout.addStretch(1)
self.main_layout.addLayout(button_layout)
self.main_layout.addStretch(1)
self.setLayout(self.main_layout)
format(self.primitive.value)
self.setMinimumWidth(450)
setFocus()
createPrimitiveSwitcher(self)
QtWidgets.QHBoxLayout()