google / nerfies

This is the code for Deformable Neural Radiance Fields, a.k.a. Nerfies.

Home Page:https://nerfies.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nerfies_Training.ipynb collab fails on import configs, having changed no settings

xvdp opened this issue · comments

commented

I ran both collabs in sequence Nerfies_Capture_Processing.ipynb and Nerfies_Training.ipynb
on the process of running the second one - having changed nothing igot an error
thanks


ValueError Traceback (most recent call last)
in ()
6 from IPython.display import display, Markdown
7
----> 8 from nerfies import configs
9
10

5 frames
/usr/lib/python3.7/dataclasses.py in _get_field(cls, a_name, a_type)
731 # For real fields, disallow mutable defaults for known types.
732 if f._field_type is _FIELD and isinstance(f.default, (list, dict, set)):
--> 733 raise ValueError(f'mutable default {type(f.default)} for field '
734 f'{f.name} is not allowed: use default_factory')
735

commented

running locallly installed code on a jupyter notebook also fails in configs -
Ill debug this, but just saying, the project is awesome, but a bit finnicky.


ValueError Traceback (most recent call last)
in
6 from IPython.display import display, Markdown
7
----> 8 from nerfies import configs
9
10

~/miniconda3/envs/abj/lib/python3.9/site-packages/nerfies/configs.py in
40 @gin.configurable()
41 @dataclasses.dataclass
---> 42 class ModelConfig:
43 """Parameters for the model."""
44 # Sample linearly in disparity rather than depth.

~/miniconda3/envs/abj/lib/python3.9/dataclasses.py in dataclass(cls, init, repr, eq, order, unsafe_hash, frozen)
1019
1020 # We're called as @DataClass without parens.
-> 1021 return wrap(cls)
1022
1023

~/miniconda3/envs/abj/lib/python3.9/dataclasses.py in wrap(cls)
1011
1012 def wrap(cls):
-> 1013 return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
1014
1015 # See if we're being called as @DataClass or @DataClass().

~/miniconda3/envs/abj/lib/python3.9/dataclasses.py in _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
861 # things, and set the default values (as class attributes) where
862 # we can.
--> 863 cls_fields = [_get_field(cls, name, type)
864 for name, type in cls_annotations.items()]
865 for f in cls_fields:

~/miniconda3/envs/abj/lib/python3.9/dataclasses.py in (.0)
861 # things, and set the default values (as class attributes) where
862 # we can.
--> 863 cls_fields = [_get_field(cls, name, type)
864 for name, type in cls_annotations.items()]
865 for f in cls_fields:

~/miniconda3/envs/abj/lib/python3.9/dataclasses.py in _get_field(cls, a_name, a_type)
745 # For real fields, disallow mutable defaults for known types.
746 if f._field_type is _FIELD and isinstance(f.default, (list, dict, set)):
--> 747 raise ValueError(f'mutable default {type(f.default)} for field '
748 f'{f.name} is not allowed: use default_factory')
749

ValueError: mutable default <class 'frozendict.core.frozendict'> for field warp_kwargs is not allowed: use default_factory

how you fix that bro ?

commented

@antonioace I'd never used frozen dict or gin-config ( not to be confused with gin), or jax for that matter!,

when defining a @DataClass some care needs to be taken on dict or frozendict or default arguments-- they need to be wrapped, and passed on creation, neither of those seems to have been done (I may have missed a beat on the original code, but thhis i say fixes it)

Ill fork test and submit something that works for me, on and offline - sometime today.

It seems like some updates to gin/flax have broken the current code (my fault for not freezing the version in the instructions).

I'll upload a fix sometimes this week.

commented

thanks @keunhong - great project, thanks for the work.

My x_dev branch fixes the issue, or patches it, your call.

changed 2 files:
https://github.com/xvdp/nerfies/blob/x_dev/nerfies/configs.py
#replace frozendict with field(default_factory=frozendict.frozendict)

https://github.com/xvdp/nerfies/blob/x_dev/notebooks/Nerfies_Training.ipynb
#pass missing values to frozendict ( lr_schedule)

I didnt check all your configs, but you seems to me that as used. dataclass cannot pass default dict args,
I can do a pull request if you want,

-- i see there are more errors around frozen dict - Im running the Training collab on another window

Seems like I'm still getting this issue. Anyway I can bypass it? Thanks.

Tied "!pip install git+https://github.com/xvdp/nerfies@x_dev" in notebook, but there is no lucky.

Hi, this should be fixed now. Sorry it took so long.