Skip to content

Restoring from checkpoints given an experiment folder#16

Open
jamaltoutouh wants to merge 1 commit intomasterfrom
jt/restoring-from-checkpoint-v1
Open

Restoring from checkpoints given an experiment folder#16
jamaltoutouh wants to merge 1 commit intomasterfrom
jt/restoring-from-checkpoint-v1

Conversation

@jamaltoutouh
Copy link
Collaborator

No description provided.

self.grid_position = (checkpoint['topology_details']['position'][0], checkpoint['topology_details']['position'][1])
self.local_node = checkpoint['topology_details']['cell_info']
self.cell_number = checkpoint['cell_number']
self.neighbours = checkpoint['adjacent_cells']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do the checkpoints keys have different names from the variables?

splitted_source = source.split(':')
return {'address': splitted_source[0], 'port': splitted_source[1], 'id': source}

class ExperimentResuming():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to checkpoint.py and ExperimentRestarter makes it easier to read

return checkpoint

def get_population_cell_info(self):
client_soueces = self.get_population_sources()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

soeces=sources

return clients

def get_population_sources(self):
sources = set()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a set is it intentional to get different size populations?

[sources.add(local_discriminator) for local_discriminator in checkpoint['local_discriminators']]
return list(sources)

def get_local_generators_paths(self, source):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like code duplication for 2 methods, that could be simplified with function parameters e.g. get_checkpoint_local_values(self, source, key)

cc.settings = read_settings(args.configuration_file)
if args.checkpoint_folder is not None:
cc.settings['general']['distribution']['auto_discover'] = False
cc.settings['general']['distribution']['resuming'] = args.checkpoint_folder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resume = resuming easier to read

gen, dis = self.network_factory.create_both()
populations[TYPE_GENERATOR].individuals.append(Individual(genome=gen, fitness=gen.default_fitness))
populations[TYPE_DISCRIMINATOR].individuals.append(Individual(genome=dis, fitness=dis.default_fitness))
if checkpoint is not None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe reverse branches and write if checkpoint for readability


# Resume status from checkpoint
checkpoint = self.cc.settings['general']['distribution'].get('client_checkpoint', None)
if checkpoint is not None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe reverse branches and write if checkpoint for readability


def read_ckeckpoint(self):
checkpoint = self.cc.settings['general']['distribution']['client_checkpoint']
return checkpoint.get('iteration', 0), float(checkpoint.get('generators_learning_rate', None)), float(checkpoint.get('discriminators_learning_rate', None))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is None a good default value?


for iteration in range(n_iterations):
while(self.iteration < n_iterations):
iteration = self.iteration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants