MCPcopy Create free account
hub / github.com/eric-mitchell/direct-preference-optimization / __enter__

Method __enter__

utils.py:163–170  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

161 self.stored_np_state = None
162
163 def __enter__(self):
164 # Store the current random state
165 self.stored_state = random.getstate()
166 self.stored_np_state = np.random.get_state()
167
168 # Set the random seed
169 random.seed(self.seed)
170 np.random.seed(self.seed)
171
172 def __exit__(self, exc_type, exc_value, traceback):
173 # Restore the random state

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected