-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Description
Describe the bug
When a dataclass is instantiated using keyword arguments, the non-existing keyword is not being report as error. This gives the user the erroneous sense that all the argument is correctly initialized. It would be nice if non-existing argument name will cause an error.
To Reproduce
In the following example, we should expect MyClass(a=1, c=2)
to raise an error. Instead, it initialize MyClass with a=1, b=0.
import taichi as ti
@ti.dataclass
class MyClass:
a: int
b: in
print(MyClass(a=1, c=2))
Log/Screenshots
Python 3.10.12 (main, Mar 22 2024, 16:50:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import taichi as ti
[Taichi] version 1.7.3, llvm 15.0.4, commit 5ec301be, linux, python 3.10.12
>>> @ti.dataclass
... class MyClass:
... a: int
... b: int
...
>>>
>>> print(MyClass(a=1, c=2))
{'a': 1, 'b': 0}
Additional comments
ti diagnose
output
[Taichi] version 1.7.3, llvm 15.0.4, commit 5ec301be, linux, python 3.10.12
*******************************************
** Taichi Programming Language **
*******************************************
Docs: https://docs.taichi-lang.org/
GitHub: https://github.com/taichi-dev/taichi/
Forum: https://forum.taichi.graphics/
Taichi system diagnose:
python: 3.10.12 (main, Mar 22 2024, 16:50:05) [GCC 11.4.0]
system: linux
executable: /home/weixu/venvs/working/bin/python
platform: Linux-6.5.0-41-generic-x86_64-with-glibc2.35
architecture: 64bit ELF
uname: uname_result(system='Linux', node='GAIL-X', release='6.5.0-41-generic', version='#41~22.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun 3 11:32:55 UTC 2', machine='x86_64')
locale: en_US.UTF-8
PATH: /home/weixu/venvs/working/bin:/data/weixu/bin:/home/weixu/.local/bin:/home/weixu/miniconda3/condabin:/data/weixu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PYTHONPATH: ['/home/weixu/venvs/working/bin', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/home/weixu/venvs/working/lib/python3.10/site-packages', '__editable__.omni_isaac_lab-0.22.4.finder.__path_hook__', '__editable__.omni_isaac_lab_assets-0.1.3.finder.__path_hook__', '__editable__.omni_isaac_lab_tasks-0.10.0.finder.__path_hook__', '/data/weixu/code/hobot_submission', '/home/weixu/venvs/working/lib/python3.10/site-packages/fused_linear_relu-0.0.0-py3.10-linux-x86_64.egg']
`lsb_release` not available: [Errno 2] No such file or directory: 'lsb_release'
import: <module 'taichi' from '/home/weixu/venvs/working/lib/python3.10/site-packages/taichi/__init__.py'>
cpu: True
metal: False
opengl: True
cuda: True
vulkan: True
`glewinfo` not available: [Errno 2] No such file or directory: 'glewinfo'
Tue Jun 17 18:09:43 2025
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.104.05 Driver Version: 535.104.05 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce RTX 3090 On | 00000000:17:00.0 Off | N/A |
| 55% 59C P5 99W / 420W | 2336MiB / 24576MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
| 1 NVIDIA GeForce RTX 3090 On | 00000000:65:00.0 Off | N/A |
| 0% 54C P8 36W / 420W | 271MiB / 24576MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 1533 G /usr/lib/xorg/Xorg 167MiB |
| 0 N/A N/A 1669 G /usr/bin/gnome-shell 11MiB |
| 0 N/A N/A 432606 C /home/weixu/venvs/working/bin/python 2142MiB |
| 1 N/A N/A 1533 G /usr/lib/xorg/Xorg 4MiB |
| 1 N/A N/A 432606 C /home/weixu/venvs/working/bin/python 254MiB |
+---------------------------------------------------------------------------------------+
[Taichi] version 1.7.3, llvm 15.0.4, commit 5ec301be, linux, python 3.10.12
[Taichi] version 1.7.3, llvm 15.0.4, commit 5ec301be, linux, python 3.10.12
[Taichi] Starting on arch=x64
[Taichi] version 1.7.3, llvm 15.0.4, commit 5ec301be, linux, python 3.10.12
[Taichi] Starting on arch=opengl
[Taichi] version 1.7.3, llvm 15.0.4, commit 5ec301be, linux, python 3.10.12
[Taichi] Starting on arch=cuda
[Taichi] version 1.7.3, llvm 15.0.4, commit 5ec301be, linux, python 3.10.12
*******************************************
** Taichi Programming Language **
*******************************************
Docs: https://docs.taichi-lang.org/
GitHub: https://github.com/taichi-dev/taichi/
Forum: https://forum.taichi.graphics/
TAICHI EXAMPLES
────────────────────────────────────────────────────────────────────────────────────
0: ad_gravity 25: karman_vortex_street 50: patterns
1: circle_packing_image 26: keyboard 51: pbf2d
2: comet 27: laplace 52: physarum
3: cornell_box 28: laplace_equation 53: poisson_disk_sampling
4: diff_sph 29: mandelbrot_zoom 54: print_offset
5: differential_evolution 30: marching_squares 55: rasterizer
6: euler 31: mass_spring_3d_ggui 56: regression
7: eulerfluid2d 32: mass_spring_game 57: sdf_renderer
8: explicit_activation 33: mass_spring_game_ggui 58: simple_derivative
9: export_mesh 34: mciso_advanced 59: simple_texture
10: export_ply 35: mgpcg 60: simple_uv
11: export_videos 36: mgpcg_advanced 61: snow_phaseField
12: fem128 37: minimal 62: stable_fluid
13: fem128_ggui 38: minimization 63: stable_fluid_ggui
14: fem99 39: mpm128 64: stable_fluid_graph
15: fractal 40: mpm128_ggui 65: taichi_bitmasked
16: fractal3d_ggui 41: mpm3d 66: taichi_dynamic
17: fullscreen 42: mpm3d_ggui 67: taichi_logo
18: game_of_life 43: mpm88 68: taichi_ngp
19: gui_image_io 44: mpm88_graph 69: taichi_sparse
20: gui_widgets 45: mpm99 70: texture_graph
21: implicit_fem 46: mpm_lagrangian_forces 71: tutorial
22: implicit_mass_spring 47: nbody 72: two_stream_instability
23: initial_value_problem 48: odop_solar 73: vortex_rings
24: jacobian 49: oit_renderer 74: waterwave
────────────────────────────────────────────────────────────────────────────────────
42
Running example minimal ...
[Taichi] Starting on arch=x64
42.0
>>> Running time: 0.15s
Consider attaching this log when maintainers ask about system information.
>>> Running time: 4.37s
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Untriaged