You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to do some more complicated configuration file setups which include putting together a couple of lazy ints to a lazy tuple. The following script is an example how I can get it to work. However the resulting FieldReference object stores a tuple but thinks it's storing an int.
Traceback (most recent call last):
File "/home/andrius/repos/sde-sampling/tmp.py", line 8, in <module>
a_tuple = FieldReference(a, tuple, op=_Op(lambda x : (x,), ()))
File "/home/andrius/env/lib/python3.10/site-packages/ml_collections/config_dict/config_dict.py", line 248, in __init__
self.set(default)
File "/home/andrius/env/lib/python3.10/site-packages/ml_collections/config_dict/config_dict.py", line 305, in set
raise TypeError('Reference is of type {} but should be of type {}'
TypeError: Reference is of type <class 'int'> but should be of type <class 'tuple'>
I think it would be better to change the behaviour as follows:
If field_type is not specified when a FieldReference object is constructed, set it to the type of the argument default as it is done now.
If field_type it is specified, then:
If op is not specified and field_type is different from the type of default, raise an exception.
If op is specified, raise an exception in get if the result of op is not the same as the field_type specified.
I'd be happy to file a PR if authors agree.
The text was updated successfully, but these errors were encountered:
Hi, I am trying to do some more complicated configuration file setups which include putting together a couple of lazy ints to a lazy tuple. The following script is an example how I can get it to work. However the resulting
FieldReference
object stores a tuple but thinks it's storing an int.This outputs
Which is probably a bug. This was run on python 3.10.8 and
ml_collections
0.1.1.Note that if we change the script to
it throws an exception:
I think it would be better to change the behaviour as follows:
field_type
is not specified when aFieldReference
object is constructed, set it to the type of the argumentdefault
as it is done now.field_type
it is specified, then:op
is not specified andfield_type
is different from the type ofdefault
, raise an exception.op
is specified, raise an exception inget
if the result ofop
is not the same as thefield_type
specified.I'd be happy to file a PR if authors agree.
The text was updated successfully, but these errors were encountered: