python – wandb – how to get it really silent (weights and biases)


Working with Anaconda-Spyder (python 3.7), I installed the latest release of wandb (0.10.7) and try to use it with tensorflow (2.1.0) and keras (2.3.1). Since then, my console is polluted with lengthy comments due to wandb. So far I am using config and logs (not yet sweeps). It worked well for several runs BUT I cannot handle the outcome of my code that disappear in a flow of messages.

I’d like to get rid of these messages (or find an alternative to wandb…)
Thanks in advance for your help 😉

Here is code to import the necessary libraries :

import os os.environ(‘TF_CPP_MIN_LOG_LEVEL’) = ‘3’ import numpy as np
import pandas as pd import tensorflow as tf from tensorflow import
keras from tensorflow.keras.layers import Dropout, Dense, LSTM,
Flatten, Activation from tensorflow.keras.layers import Concatenate
from tensorflow.keras import models from tensorflow.keras.models
import Sequential from tensorflow.keras.optimizers import Adam import
wandb os.environ(“WANDB_SILENT”) = “true”
wandb.init(project=”project_tsa”)

Later on, I define the wandb config as follows:
wandb.init(config={“project_name”:”project_tsa”,
“architecture”: “ResNet”,
“load_weights”: load_weights,
“epochs”: epochs,
“batch_size”: batch_size,
“iterations”: iterat,
“dropout”: dropout,
“learning_rate”: learning,
“features”: n_feature_maps,
“sequence”: seq_length})

Eventually, I define several logs :

wandb.log({"precis_pos": precis})
wandb.log({"recall_pos": recall})
wandb.log({"sortino_pos": sharpe_all(4)})
wandb.log({"sortinogain_pos": (sharpe_all(4)-sharpe_all(3))})

As soon as wandb.init is present, I automatically get ten lines of warnings :

wandb: WARNING Calling wandb.login() after wandb.init() has no effect.
<IPython.core.display.HTML object>
VBox(children=(Label(value=' 0.00MB of 0.00MB uploaded (0.00MB deduped)r'), FloatProgress(value=1.0, max=1.0)…
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
wandb: WARNING Calling wandb.login() after wandb.init() has no effect.
<IPython.core.display.HTML object>
VBox(children=(Label(value=' 0.00MB of 0.00MB uploaded (0.00MB deduped)r'), FloatProgress(value=0.0, max=1.0)…
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>
<IPython.core.display.HTML object>

As soon as I define config (and even worse with the logs), the code ends with more than a hundred lines of warning…. Here are just a few as example :

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:Anaconda3libthreading.py", line 926, in _bootstrap_inner
    self.run()
  File "D:Anaconda3libsite-packageswandbfilesyncupload_job.py", line 40, in run
    success = self.push()
  File "D:Anaconda3libsite-packageswandbfilesyncupload_job.py", line 88, in push
    _, upload_headers, result = self._api.upload_urls(project, (self.save_name))
  File "D:Anaconda3libsite-packageswandbapisnormalize.py", line 62, in wrapper
    six.reraise(CommError, CommError(message, err), sys.exc_info()(2))
  File "D:Anaconda3libsite-packagessix.py", line 702, in reraise
    raise value.with_traceback(tb)
  File "D:Anaconda3libsite-packageswandbapisnormalize.py", line 24, in wrapper
    return func(*args, **kwargs)
  File "D:Anaconda3libsite-packageswandbinternalinternal_api.py", line 1039, in upload_urls
    run = query_result("model")("bucket")
wandb.errors.error.CommError: 'NoneType' object is not subscriptable

(SpyderKernelApp) WARNING | No such comm: 4562c8582bde4c50aedbd77151a94274
(SpyderKernelApp) WARNING | No such comm: 197a5ff2d95849a0bd7d021f29e5f90e
(SpyderKernelApp) WARNING | No such comm: c4ef2bdbcfb340e48c52099c8ac96dc1
(SpyderKernelApp) WARNING | No such comm: 8898f986226043bfed836c08517299cb
(SpyderKernelApp) WARNING | No such comm: 7fbb1deccf8c40629d95c57c6cbd2e6b
(SpyderKernelApp) WARNING | No such comm: 1531c7eb303c4957e97426051d48441b