MCPcopy
hub / github.com/huggingface/transformers / state_dict

Method state_dict

src/transformers/optimization.py:859–890  ·  view source on GitHub ↗

Return the state of the scheduler as a dictionary.

(self)

Source from the content-addressed store, hash-verified

857 return self._last_lr
858
859 def state_dict(self) -> dict[str, Any]:
860 """Return the state of the scheduler as a dictionary."""
861 state = {
862 "factor": self.factor,
863 "min_lrs": self.min_lrs,
864 "max_lrs": self.max_lrs,
865 "patience": self.patience,
866 "verbose": self.verbose,
867 "cooldown": self.cooldown,
868 "warmup": self.warmup,
869 "cooldown_counter": self.cooldown_counter,
870 "warmup_counter": self.warmup_counter,
871 "mode": self.mode,
872 "threshold": self.threshold,
873 "threshold_mode": self.threshold_mode,
874 "best": self.best,
875 "num_bad_epochs": self.num_bad_epochs,
876 "num_good_epochs": self.num_good_epochs,
877 "eps": self.eps,
878 "last_epoch": self.last_epoch,
879 "smooth": self.smooth,
880 "window_size": self.window_size,
881 "reset_start": self.reset_start,
882 "reset_start_original": self.reset_start_original,
883 "_last_lr": self._last_lr,
884 "_init_lrs": self._init_lrs,
885 }
886
887 if self.smooth and self._streaming_avg is not None:
888 state["_streaming_avg"] = self._streaming_avg.state_dict()
889
890 return state
891
892 def load_state_dict(self, state_dict: dict[str, Any]) -> None:
893 """Load state from a dictionary."""

Callers 15

save_pretrainedMethod · 0.45
load_sharded_checkpointFunction · 0.45
get_gguf_hf_weights_mapFunction · 0.45
_save_scalerMethod · 0.45
save_modelMethod · 0.45
_saveMethod · 0.45
_tune_save_checkpointMethod · 0.45
save_tpu_checkpointFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected