Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConfigDict does not allow dictionary key to be int type #13

Open
Michael-H777 opened this issue Feb 18, 2022 · 0 comments
Open

ConfigDict does not allow dictionary key to be int type #13

Michael-H777 opened this issue Feb 18, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Michael-H777
Copy link

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

image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants