MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / _initialize_params

Method _initialize_params

deepspeed/runtime/config.py:486–592  ·  view source on GitHub ↗
(self, param_dict)

Source from the content-addressed store, hash-verified

484 self._do_sanity_check()
485
486 def _initialize_params(self, param_dict):
487 self.train_batch_size = get_train_batch_size(param_dict)
488 self.train_micro_batch_size_per_gpu = get_train_micro_batch_size_per_gpu(param_dict)
489 self.gradient_accumulation_steps = get_gradient_accumulation_steps(param_dict)
490 self.managed_gradient_accumulation = get_managed_gradient_accumulation(param_dict)
491 self.steps_per_print = get_steps_per_print(param_dict)
492 self.dump_state = get_dump_state(param_dict)
493 self.disable_python_gc = get_disable_python_gc(param_dict)
494
495 self.disable_allgather = get_disable_allgather(param_dict)
496 self.communication_data_type = get_communication_data_type(param_dict)
497 self.seq_parallel_communication_data_type = get_communication_data_type(
498 param_dict, SEQ_PARALLEL_COMMUNICATION_DATA_TYPE, SEQ_PARALLEL_COMMUNICATION_DATA_TYPE_DEFAULT)
499 self.prescale_gradients = get_prescale_gradients(param_dict)
500 self.gradient_predivide_factor = get_gradient_predivide_factor(param_dict)
501 self.gradient_allreduce_op = get_gradient_allreduce_op(param_dict)
502
503 self.zero_config = get_zero_config(param_dict)
504 self.zero_optimization_stage = self.zero_config.stage
505 self.zero_enabled = self.zero_optimization_stage > 0
506
507 self.activation_checkpointing_config = DeepSpeedActivationCheckpointingConfig(param_dict)
508
509 self.comms_config = DeepSpeedCommsConfig(param_dict)
510 self.monitor_config = get_monitor_config(param_dict)
511
512 self.gradient_clipping = get_gradient_clipping(param_dict)
513 self.float16_config = get_float16_config(param_dict)
514 self.bfloat16_config = get_bfloat16_config(param_dict)
515 assert not (self.float16_config.enabled
516 and self.bfloat16_config.enabled), 'bfloat16 and fp16 modes cannot be simultaneously enabled'
517
518 self.torch_autocast_enabled = get_torch_autocast_enabled(param_dict)
519 self.torch_autocast_dtype = get_torch_autocast_dtype(param_dict)
520 self.torch_autocast_lower_precision_safe_modules = get_lower_precision_safe_modules(param_dict)
521
522 self.optimizer_name = get_optimizer_name(param_dict)
523 if (self.optimizer_name is not None and self.optimizer_name.lower() in DEEPSPEED_OPTIMIZERS):
524 self.optimizer_name = self.optimizer_name.lower()
525
526 self.optimizer_params = get_optimizer_params(param_dict)
527 self.optimizer_legacy_fusion = get_optimizer_legacy_fusion(param_dict)
528
529 self.zero_allow_untested_optimizer = get_zero_allow_untested_optimizer(param_dict)
530
531 self.zero_force_ds_cpu_optimizer = get_zero_force_ds_cpu_optimizer(param_dict)
532
533 self.scheduler_name = get_scheduler_name(param_dict)
534 self.scheduler_params = get_scheduler_params(param_dict)
535
536 self.flops_profiler_config = DeepSpeedFlopsProfilerConfig(param_dict)
537 self.wall_clock_breakdown = (get_wall_clock_breakdown(param_dict) | self.flops_profiler_config.enabled)
538 self.memory_breakdown = get_memory_breakdown(param_dict)
539 self.autotuning_config = DeepSpeedAutotuningConfig(param_dict)
540
541 self.use_data_before_expert_parallel_ = get_expert_data_topo_config(param_dict)
542 self.hybrid_engine = get_hybrid_engine_config(param_dict)
543

Callers 1

__init__Method · 0.95

Calls 15

get_train_batch_sizeFunction · 0.85
get_steps_per_printFunction · 0.85
get_dump_stateFunction · 0.85
get_disable_python_gcFunction · 0.85
get_disable_allgatherFunction · 0.85
get_prescale_gradientsFunction · 0.85

Tested by

no test coverage detected