paulpuren/PhyCRNet

No model found

afrah opened this issue · 1 comments

afrah commented

At the begining of train function, the model is uploaded but there is no model,

model, optimizer, scheduler = load_checkpoint(model, optimizer, scheduler, pre_model_save_path)

I commented this line to enforce the code to generate a new model but I got this error,

`--------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/tmp/ipykernel_28511/1822465240.py in
13 start = time.time()
14 train_loss = train(model, input, initial_state, n_iters_adam, time_batch_size,
---> 15 lr_adam, dt, dx, model_save_path, pre_model_save_path, num_time_batch)
16 end = time.time()
17

/tmp/ipykernel_28511/4188446759.py in train(model, input, initial_state, n_iters, time_batch_size, learning_rate, dt, dx, save_path, pre_model_save_path, num_time_batch)
35
36 # output is a list
---> 37 output, second_last_state = model(hidden_state, u0)
38
39 # [t, c, height (Y), width (X)]

~/anaconda3/envs/twoPhase/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
725 result = self._slow_forward(*input, **kwargs)
726 else:
--> 727 result = self.forward(*input, **kwargs)
728 for hook in itertools.chain(
729 _global_forward_hooks.values(),

/tmp/ipykernel_28511/1566267331.py in forward(self, initial_state, x)
85 # one-step forward
86 (h, c) = internal_state[i - self.num_encoder]
---> 87 x, new_c = getattr(self, name)(x, h, c)
88 internal_state[i - self.num_encoder] = (x, new_c)
89

~/anaconda3/envs/twoPhase/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
725 result = self._slow_forward(*input, **kwargs)
726 else:
--> 727 result = self.forward(*input, **kwargs)
728 for hook in itertools.chain(
729 _global_forward_hooks.values(),

/tmp/ipykernel_28511/3951104009.py in forward(self, x, h, c)
56 def forward(self, x, h, c):
57
---> 58 ci = torch.sigmoid(self.Wxi(x) + self.Whi(h))
59 cf = torch.sigmoid(self.Wxf(x) + self.Whf(h))
60 cc = cf * c + ci * torch.tanh(self.Wxc(x) + self.Whc(h))

RuntimeError: The size of tensor a (32) must match the size of tensor b (16) at non-singleton dimension 3`

afrah commented

Commenting the line above and changing Burgers_2d_solver_[HighOrder].py line 199 to:

M, N = 128, 128
and
Instead of ,
x = np.linspace(xmin, xmax,128+1)
put,
x = np.linspace(xmin, xmax, u_pred.shape[0]+1)
fixed this issue for me.