Start documenting the models, and change the default FOV on fancy_ptycho reconstruction inspections

This commit is contained in:
Abe Levitan authored and Abe Levitan committed 2023-10-17 15:38:48 +02:00
1 parent 88aedcc448
commit e8023703a0
11 files changed
+315 -471

No files matched your search

Binary file not shown.
+1 -1
View File
@@ -15,7 +15,7 @@ model.to(device='cuda')
dataset.get_as(device='cuda')
# Now, we run a short reconstruction from the dataset
for loss in model.Adam_optimize(100, dataset, batch_size=50, schedule=True):
for loss in model.Adam_optimize(10, dataset, batch_size=50, schedule=True):
# And we liveplot the updates to the model as they happen
print(model.report())
model.inspect(dataset)
+5 -6
View File
@@ -16,11 +16,6 @@ def demo():
model = cdtools.models.SimplePtycho.from_dataset(dataset)
#class MyDataParallel(t.nn.DataParallel):
# def __getattr__(self, name):
# return getattr(self.module, name)
print(dist.is_torchelastic_launched())
dist.init_process_group(backend="nccl", init_method='env://')
rank = dist.get_rank()
@@ -29,7 +24,9 @@ def demo():
print('device id', device_id)
model = model.to(device_id)
ddp_model = DDP(model, device_ids=[device_id])
print(model.loss_train)
print(model.Adam_optimize)
print(ddp_model.Adam_optimize)
sampler = torchdata.distributed.DistributedSampler(dataset)
# Make a dataloader
@@ -78,6 +75,8 @@ def demo():
#loss = dist.all_reduce(loss)
#print(it, 'time', time.time()-t0)
#print(loss / normalization)
if rank==0:
model.inspect()
return loss#.cpu().numpy()
if __name__=='__main__':
+2
View File
@@ -14,6 +14,8 @@ dataset.patterns = t.cat([dataset.patterns]*5)
# Next, we create a ptychography model from the dataset
model = cdtools.models.SimplePtycho.from_dataset(dataset)
print(model.mask)
exit()
#class MyDataParallel(t.nn.DataParallel):
# def __getattr__(self, name):
# return getattr(self.module, name)