How to reset channels in the notebook?¶
I am running experiments in the cloud notebook but I keep overwriting existing channels and causing errors. For example I run my training script:
1 2 3 4 5
import numpy as np for epoch in range(100): loss = np.random.random() ctx.channel_send('epoch_loss', epoch, loss)
and everything is fine:
but when I run it again it crashes:
How can I fix that?
You need to reset channels. There are two options to do so.
Reset named channel
ctx.channel_reset('YOUR_CHANNEL_NAME') before sending values to channel:
1 2 3
ctx.channel_reset('epoch_loss') for epoch in range(100): ...
Reset all channels
ctx.reset_all_channels() before sending values to channel:
1 2 3
ctx.reset_all_channels() for epoch in range(100): ...
Either way your channel will be reset and you could go on sending values and displaying charts with no problems: