wandb: UnicodeEncodeError: 'latin-1' codec can't encode characters when logging multiple runs
I am trying to log multiple runs from a single script, as described in the API docs using wandb.init(reinit=True) and run.finish().
It gives a strange error that I do not understand, it seems to be output related, but it only appears at the 2nd iteration of the following loop. The first run is logged correctly to w&b and is also closed without an error.
for validation_partition in all_ids:
run = wandb.init(reinit=True, name=f'Val{validation_partition}')
logger.info('Initialized new w&b run.')
#call main
setattr(args, 'experiment_name', f'crossval_{test_partition}_{validation_partition}_{time.strftime("%Y-%m-%d-%H-%M",time.gmtime())}')
best_mcc_det, best_mcc_cs = main_training_loop(args)
result_list_det.append(best_mcc_det)
result_list_cs.append(best_mcc_cs)
logger.info(f'partition {validation_partition}: MCC Detection {best_mcc_det}, MCC CS {best_mcc_cs}')
run.finish()
logger.info(f'Finished partition {validation_partition}.')
wandb: Synced Test0_Val1: https://wandb.ai/fteufel/lm-sp-crossvalidation/runs/2i3alvte
20/09/30 00:14:47 - INFO - __main__ - Finished partition 1.
wandb: wandb version 0.10.4 is available! To upgrade, please run:
wandb: $ pip install wandb --upgrade
wandb: Tracking run with wandb version 0.10.3
wandb: Syncing run Test0_Val2
Traceback (most recent call last):
File "/zhome/1d/8/153438/experiments/py3-torch-env/lib/python3.6/site-packages/wandb/sdk/wandb_init.py", line 460, in init
run = wi.init()
File "/zhome/1d/8/153438/experiments/py3-torch-env/lib/python3.6/site-packages/wandb/sdk/wandb_init.py", line 398, in init
run._on_start()
File "/zhome/1d/8/153438/experiments/py3-torch-env/lib/python3.6/site-packages/wandb/sdk/wandb_run.py", line 1220, in _on_start
self._display_run()
File "/zhome/1d/8/153438/experiments/py3-torch-env/lib/python3.6/site-packages/wandb/sdk/wandb_run.py", line 1037, in _display_run
click.style(project_url, underline=True, fg="blue"),
File "/zhome/1d/8/153438/experiments/py3-torch-env/lib/python3.6/site-packages/wandb/errors/term.py", line 33, in termlog
click.echo(line, file=sys.stderr, nl=newline)
File "/zhome/1d/8/153438/experiments/py3-torch-env/lib/python3.6/site-packages/click/utils.py", line 272, in echo
file.write(message)
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 7-8: ordinal not in range(256)
wandb: ERROR Abnormal program exit
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (3 by maintainers)
This is an issue with your terminal not supporting UTF8 characters in our output. We should detect this case, but in the meantime, setting the following in your terminal should fix this:
You can add this to your
~/.profileor~/.bash_rcif you’re on linux or mac. What OS are you guys using?