rdiehlmartinez commited on
Commit
c03487d
·
1 Parent(s): 2ebe38b

updating gradient mini steps to take the middle gradient

Browse files
Files changed (1) hide show
  1. pythia-training-metrics.py +14 -2
pythia-training-metrics.py CHANGED
@@ -87,6 +87,16 @@ class PythiaTrainingMetrics(datasets.GeneratorBasedBuilder):
87
  """
88
  return list(range(max(0, step-5), min(step+6, 143_000)))
89
 
 
 
 
 
 
 
 
 
 
 
90
  model_size = self.config.name.split("__")[0]
91
 
92
  for checkpoint_step in checkpoint_steps:
@@ -100,9 +110,11 @@ class PythiaTrainingMetrics(datasets.GeneratorBasedBuilder):
100
  to_download_files.append(f"{directory_path}/checkpoint_weights.pickle")
101
  kwargs_checkpoint_steps.append(checkpoint_step)
102
  elif "gradients" in self.config.name:
103
- gradient_steps = get_gradient_step(checkpoint_step)
104
  if "mini" in self.config.name:
105
- gradient_steps = gradient_steps[:2]
 
 
 
106
  for gradient_step in gradient_steps:
107
  to_download_files.append(f"{directory_path}/checkpoint_gradients_{gradient_step}.pickle")
108
  kwargs_checkpoint_steps.append(checkpoint_step)
 
87
  """
88
  return list(range(max(0, step-5), min(step+6, 143_000)))
89
 
90
+ def get_gradient_mini_step(step: int):
91
+ """
92
+ Return a list of the gradient steps that are used at a given checkpoint step, we
93
+ limit the amount of gradients to only 2.
94
+ """
95
+ if step != checkpoint_steps[-1]:
96
+ return [step, step+1]
97
+ else:
98
+ return [step-2, step-1]
99
+
100
  model_size = self.config.name.split("__")[0]
101
 
102
  for checkpoint_step in checkpoint_steps:
 
110
  to_download_files.append(f"{directory_path}/checkpoint_weights.pickle")
111
  kwargs_checkpoint_steps.append(checkpoint_step)
112
  elif "gradients" in self.config.name:
 
113
  if "mini" in self.config.name:
114
+ gradient_steps = get_gradient_mini_step(checkpoint_step)
115
+ else:
116
+ gradient_steps = get_gradient_step(checkpoint_step)
117
+
118
  for gradient_step in gradient_steps:
119
  to_download_files.append(f"{directory_path}/checkpoint_gradients_{gradient_step}.pickle")
120
  kwargs_checkpoint_steps.append(checkpoint_step)