jina-ai / discoart

🪩 Create Disco Diffusion artworks in one line
Other
3.84k stars 249 forks source link

Add silent mode #178

Open ilpoli opened 2 years ago

ilpoli commented 2 years ago

I'm working on fine-tuning arguments and would like to see only the optimizer progress bar, sadly Discoart doesn't support totally silent mode. This RM suggests the implementation of this feature.

Here's a piece of code that does allow you to achieve it with PR changes:

import os

os.environ['DISCOART_LOG_LEVEL'] = 'ERROR'
os.environ['DISCOART_OPTOUT_CLOUD_BACKUP'] = '1'
os.environ['DISCOART_DISABLE_IPYTHON'] = '1'
os.environ['DISCOART_DISABLE_RESULT_SUMMARY'] = '1'
os.environ['DISCOART_DISABLE_TQDM'] = '1'
os.environ['DISCOART_DISABLE_ARGS_TABLE'] = '1'
os.environ['DISCOART_OPTOUT_LOCAL_BACKUP'] = '1'

The following code hides the issue with obsoleted torchvision parameters that are used in lpips

import warnings
warnings.filterwarnings("ignore", category=UserWarning)

I mean these warnings:

/opt/conda/lib/python3.7/site-packages/torchvision/models/_utils.py:209: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and will be removed in 0.15, please use 'weights' instead.
  f"The parameter '{pretrained_param}' is deprecated since 0.13 and will be removed in 0.15, "

/opt/conda/lib/python3.7/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and will be removed in 0.15. The current behavior is equivalent to passing `weights=VGG16_Weights.IMAGENET1K_V1`. You can also use `weights=VGG16_Weights.DEFAULT` to get the most up-to-date weights.
  warnings.warn(msg)

Finally, use the following arguments:

from discoart import create

da = create(image_output=False, save_rate=-1)

This code prevents saving intermediate images and a final document.

hanxiao commented 2 years ago

hi thanks for your contribution, if you think this PR is ready, please mark it as ready from draft. 🙏 thanks

ilpoli commented 2 years ago

Hi @hanxiao , do I need to get one more approval, right?