Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFF : Modify the process that includes an initialization and iterated computation

what can I write in this code :

def initialize_fn():
  ...

like image 931
Eliza Avatar asked May 25 '26 06:05

Eliza


1 Answers

The state object returned by iterative_process.initialize() is typically a Python container (tuple, collections.OrderedDict, etc) that contains numpy arrays. To see this, try print(state) after initialize.

Perhaps simply replacing the values with the those loaded from an external file after initialze() and before loop over next():


def load_my_weights(filename):
  # read from external file, create numpy arrays

iterative_process = IterativeProcess(initialize_fn, next_fn)
state = iterative_process.initialize()
state['model'] = load_my_weights(filename)  # assumes 'model' is a key in state.
for round in range(num_rounds):
  state = iterative_process.next(state)
like image 135
Zachary Garrett Avatar answered May 27 '26 05:05

Zachary Garrett



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!