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

Issues with logging into the log file #92

Open
JB4Jaison opened this issue May 24, 2024 · 0 comments
Open

Issues with logging into the log file #92

JB4Jaison opened this issue May 24, 2024 · 0 comments

Comments

@JB4Jaison
Copy link

I was having issues with getting anything written onto the log file. The stream handler seemed to work well enough and was displaying all the information on the terminal and yet the log file was blank.

The script I executed while training was:

!omnipose --train --use_gpu --dir ./Data/train/augmented --mask_filter _masks \
         --n_epochs 200 --pretrained_model worm_omni --learning_rate 0.01 --diameter 0 \
         --batch_size 16  --RAdam --in_folders --verbose

This was done in a jupyter notebook and the OS I am using is a RHEL 7 workstation. Other details
Python: 3.9.18
Omnipose: 1.0.7.dev20+gbf456e4

I was able to get around this problem by adding

for handler in logging.root.handlers[:]:
        logging.root.removeHandler(handler)

before the

  logging.basicConfig(
                   level=logging.DEBUG if verbose else logging.INFO,
                   format="%(asctime)s [%(levelname)s] %(message)s",
                   handlers=[
                       logging.FileHandler(log_file),
                       logging.StreamHandler(sys.stdout)
                   ]
               )

I am not sure if I am overdoing things here and if there is some other way to solve this issue.

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

No branches or pull requests

1 participant