google / google/ml_collections
ConfigDict does not allow dictionary key to be int type
- Dominant language
- Python
- Stars
- 1k
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
ConfigDict() does not allow dictionary with int data type as key
**To Reproduce**
from ml_collections import ConfigDict
tmp = ConfigDict()
tmp.demo0 = 10 # no bug
tmp.demo1 = '10' # no bug
tmp.demo2 = {'0': '10', '1': '20'} # no bug
tmp.demo3 = {0: '10', 1: '20'} # bug
***ConfigDict***

***ConfigFlags***
im not sure how to provide config flags, therefore i created a brand new conda virtual env to demonstrate the bug.
~$ conda create --name bug python=3.8
~$ conda activate bug
~$ pip install ml-collections
~$ python
from ml_collections import ConfigDict
tmp = ConfigDict()
tmp.demo = {0: '10', 1: '20'}
**Expected behavior**
the should run, and save the dictionary without issue
**Environment:**
- OS: ubuntu
- OS Version: 20
- Python: 3.8
**Additional context**
when I changed the key to str type, the code runs. However I want to be able to use str type.
Contributor guide
Assessment
This issue has not been assessed yet.