mirror of
https://github.com/cdtools-developers/cdtools.git
synced 2026-11-29 00:17:48 +01:00
Start documenting the models, and change the default FOV on fancy_ptycho reconstruction inspections
This commit is contained in:
1 parent
88aedcc448
commit
e8023703a0
11 files changed
+315
-471
No files matched your search
Binary file not shown.
@@ -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)
|
||||
|
||||
@@ -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__':
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user