Open wooodswu opened 1 year ago
You can pass a callable to the Model class: for example, _loss=torch.nn.functional.l1loss instead of loss='mse'. And as far as I understand from the source code, a list of mixed identifiers/callables for the equations and the conditions also can be used.
You can pass a callable to the Model class: for example, _loss=torch.nn.functional.l1loss instead of loss='mse'. And as far as I understand from the source code, a list of mixed identifiers/callables for the equations and the conditions also can be used.
Could you tell me where the mixed identifiers/callables for the equation is and in which module? i have not found this in this package. Thanks a lot.
Check this get()
function, which returns the loss function itself to the model during the initialization process. The check for callable is on the line 70.
You can use this feature like this: model.compile('adam', lr=1e-3, loss=torch.nn.functional.l1_loss)
.
Hello, could you help solve the problems "Error: The network has multiple inputs, and saving such result han't been implemented." when I choose the DeepONet as my net. Thank you so much if you could help me!
Hello, could you help solve the problems "Error: The network has multiple inputs, and saving such result han't been implemented." when I choose the DeepONet as my net. Thank you so much if you could help me!
As far as I understand, your network uses multiple input "streams", and DeepXDE has not implemented saving and plotting input-output states for such models yet. In my opinion, you have several options:
1) not use the deepxde.saveplot
function at all
losshistory
using deepxde.utils.external.plot_loss_history
and deepxde.utils.external.save_loss_history
or your own codetrain_state
) using your own code (in this case you need to examine the train_state
structure, which is, as far as I remember, a combination of inputs and outputs; where the inputs are the internal area + external area points, and then external area points again for boundary conditions and also initial conditions area points, concatenated together; also check the deepxde.utils.external.save_best_state
function, it is for single input "stream" networks)
2) modify your network to use a single input "steam" and continue to use the stock DeepXDE functions
Need your help! I have a question about this “losses_fn", except in the definition of “outputs_losses”, i cannot find this function. When I want to change the loss function, and using the following:
/*code
net = dde.maps.DeepONetCartesianProd( [101,30,30,101], [1,30,30,101], "relu", "Glorot normal")
model2 =dde.Model(data, net) model2.compile("adam", lr=3e-4, loss=“mse", metrics=["l2 relative error"], )
*/ loss in dde.Model.compile()
by my understanding, is just the “loss_fn”(here is just mse) in the “losses_fn", and I cannot find the “losses_fn” in the whole package.
My question: could I change this losses_fn? is this the loss function I need to define? Or in the somewhere of the model, where can I change the loss?