MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / _set_random_seed

Function _set_random_seed

DeepSpeedExample/megatron/initialize.py:181–190  ·  view source on GitHub ↗

Set random seed for reproducability.

(seed)

Source from the content-addressed store, hash-verified

179
180
181def _set_random_seed(seed):
182 """Set random seed for reproducability."""
183 if seed is not None and seed > 0:
184 random.seed(seed)
185 np.random.seed(seed)
186 torch.manual_seed(seed)
187 if torch.cuda.device_count() > 0:
188 mpu.model_parallel_cuda_manual_seed(seed)
189 else:
190 raise ValueError('Seed ({}) should be a positive integer.'.format(seed))
191
192
193def _write_args_to_tensorboard():

Callers 1

finish_mpu_initFunction · 0.85

Calls 2

manual_seedMethod · 0.45
device_countMethod · 0.45

Tested by

no test coverage detected