wanmeihuali / taichi_3d_gaussian_splatting

An unofficial implementation of paper 3D Gaussian Splatting for Real-Time Radiance Field Rendering by taichi lang.
Apache License 2.0
637 stars 58 forks source link

'use default_factory' error on python 3.11 #134

Open expenses opened 9 months ago

expenses commented 9 months ago

Hi, when I tried to run this initially I got the following error:

[Taichi] version 1.6.0, llvm 15.0.4, commit f1c6fbbd, linux, python 3.11.5
Traceback (most recent call last):
  File "/home/ashley/projects/taichi_3d_gaussian_splatting/gaussian_point_train.py", line 3, in <module>
    from taichi_3d_gaussian_splatting.GaussianPointTrainer import GaussianPointCloudTrainer
  File "/home/ashley/projects/taichi_3d_gaussian_splatting/taichi_3d_gaussian_splatting/GaussianPointTrainer.py", line 31, in <module>
    class GaussianPointCloudTrainer:
  File "/home/ashley/projects/taichi_3d_gaussian_splatting/taichi_3d_gaussian_splatting/GaussianPointTrainer.py", line 32, in GaussianPointCloudTrainer
    @dataclass
     ^^^^^^^^^
  File "/home/ashley/.pyenv/versions/3.11.5/lib/python3.11/dataclasses.py", line 1230, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/home/ashley/.pyenv/versions/3.11.5/lib/python3.11/dataclasses.py", line 1220, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ashley/.pyenv/versions/3.11.5/lib/python3.11/dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ashley/.pyenv/versions/3.11.5/lib/python3.11/dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'taichi_3d_gaussian_splatting.GaussianPointCloudRasterisation.GaussianPointCloudRasterisation.GaussianPointCloudRasterisationConfig'> for field rasterisation_config is not allowed: use default_factory

This only occurs with python 3.11, 3.10 doesn't have any issues so it's not a deal-breaker.

wanmeihuali commented 9 months ago

I think @yanzhoupan has seen a similar issue.