Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add verbose to dde.model.train and dde.model.compile #1879

Merged

Conversation

KangyuWeng
Copy link
Contributor

Purpose

This pull request aims to add a verbose parameter to the dde.model.train() and dde.model.compile() methods. This addition allows users to control the verbosity of these methods, which is important in federated learning.

Changes Made

  1. Set the optional values of verbose to be 0 or 1.
  • This is the same with the verbose in other parts of deepxde and make it possible for future extensions of adding verbose=2.
  1. Added the verbose parameter to train() and compile().
  • The verbose parameter is added to both dde.model.train() and dde.model.compile().
  • Default is verbose=1, without any changes to the original methods.
  • Setting verbose=0 will silent all outputs.
  1. Read verbose parameter in the decorator utils.timing.
  • When verbose=0 is passed to utils.timing, it will no longer print the timing information.
  • Default is verbose=1 which prevents affecting other methods using the decorator utils.timing.
  1. Added verbose parameter in model._test()
  • When verbose=0, there should be no output, including test loss. So, display.training_display() in model._test() is disabled when verbose = 0.
  1. Disable display.training_display() in TensorFlow v1 compatibility mode.
  • This is modified to be disabled when verbose=0.

Test

Example used: https://deepxde.readthedocs.io/en/latest/demos/pinn_forward/ode.system.html.

Backend tested: pytorch, jax, paddle.

Problem: The new verbose feature works well overall. But there are thousands of output like "I1106 13:10:16.057708 3995094848 kernel_dispatch.h:102] Get BackendSet from tensor" when using paddle as the backend. This problem also occurs when using the original deepxde, before any changes.

Notes

Maybe we could disable timeit.default_timer() in the utils.timing() when verbose=0.

@KangyuWeng KangyuWeng closed this Nov 6, 2024
@KangyuWeng KangyuWeng deleted the add-verbose-to-train-and-compile branch November 6, 2024 18:16
@KangyuWeng KangyuWeng restored the add-verbose-to-train-and-compile branch November 6, 2024 18:21
@KangyuWeng KangyuWeng reopened this Nov 6, 2024
deepxde/utils/internal.py Outdated Show resolved Hide resolved
@lululxvi lululxvi merged commit c816a11 into lululxvi:master Nov 7, 2024
11 checks passed
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