Skip to content

non-str key in hparam dict causes exception in logging #5311

@indigoviolet

Description

@indigoviolet

🐛 Bug

The _flatten_dict function in LightningLoggerBase assumes that dicts will only have string keys. Passing a hparam like {2:3} will break it.

Please reproduce using the BoringModel

https://colab.research.google.com/drive/1qN5oIzPcH18QSZhAMy9N-YDkeDkc4-fy

To Reproduce

Use following BoringModel and post here

Expected behavior

It should cast to str before logging

Environment

Note: Bugs with code are solved faster ! Colab Notebook should be made public !

You can get the script and run it with:

wget https://raw.githubusercontent.com/PyTorchLightning/pytorch-lightning/master/tests/collect_env_details.py
# For security purposes, please check the contents of collect_env_details.py before running it.
* CUDA:
	- GPU:
		- Tesla T4
	- available:         True
	- version:           10.1
* Packages:
	- numpy:             1.18.5
	- pyTorch_debug:     False
	- pyTorch_version:   1.6.0+cu101
	- pytorch-lightning: 0.10.0
	- tqdm:              4.41.1
* System:
	- OS:                Linux
	- architecture:
		- 64bit
		- 
	- processor:         x86_64
	- python:            3.6.9
	- version:           #1 SMP Thu Jul 23 08:00:38 PDT 2020
### Additional context

<!-- Add any other context about the problem here. -->

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedOpen to be worked onpriority: 1Medium priority task

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions