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

Method __init__

utils.py:157–161  ·  view source on GitHub ↗

Temporarily set the random seed, and then restore it when exiting the context.

(self, seed)

Source from the content-addressed store, hash-verified

155
156class TemporarilySeededRandom:
157 def __init__(self, seed):
158 """Temporarily set the random seed, and then restore it when exiting the context."""
159 self.seed = seed
160 self.stored_state = None
161 self.stored_np_state = None
162
163 def __enter__(self):
164 # Store the current random state

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected