-
Notifications
You must be signed in to change notification settings - Fork 3
Description
入门小白,求教大佬。
最近在学习magpy的使用和阅读您官网上的文章,希望使用magpy加速pth模型(scriptmodel)。在编译allegro模型的时候遇到以下问题,希望您可以帮忙指点。
背景:allegro是基于nequip机器学习势的插件,nequip保存scriptmodel后deployed形成pth文件,这个文件netron无法看到输入维度。
我通过ase加载模型(torch.jit.load),然后调用from frontend.compile import compile 的compile方法。似乎出现了编译后的状态,但是仍旧有问题。
问题:您在paritybench测试的时候。allegro是否可以通过测试?若通过测试,以下问题我应该怎么处理?
报错信息如下:
(magpy) worldpeace@rtx3090:~/ASE$ source ase_run.sh
/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/nequip/init.py:20: UserWarning: !! PyTorch version 2.0.1 found. Upstream issues in PyTorch versions 1.13.* and 2.* have been seen to cause unusual performance degredations on some CUDA systems that become worse over time; see mir-group/nequip#311. The best tested PyTorch version to use with CUDA devices is 1.11; while using other versions if you observe this problem, an unexpected lack of this problem, or other strange behavior, please post in the linked GitHub issue.
warnings.warn(
ptxas: symbol lookup error: /home/worldpeace/soft/MagPy/build/ldlong.v3.9.12.so: undefined symbol: PyFloat_Type
/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/nequip/utils/_global_options.py:62: UserWarning: Setting the GLOBAL value for jit fusion strategy to [('DYNAMIC', 3)] which is different than the previous value of [('STATIC', 2), ('DYNAMIC', 10)]
warnings.warn(
/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/nequip/utils/_global_options.py:108: UserWarning: Setting the GLOBAL value for torch.set_default_dtype to torch.float64 which is different than the previous value of torch.float32
warnings.warn(
/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/nequip/ase/nequip_calculator.py:82: UserWarning: Trying to use chemical symbols as NequIP type names; this may not be correct for your model! To avoid this warning, please provide species_to_type_name explicitly.
warnings.warn(
/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/ase/md/md.py:52: FutureWarning: Specify the temperature in K using the 'temperature_K' argument
warnings.warn(FutureWarning(w))
INFO [model_run.py:156]
Starting dynamics with Nose-Hoover Thermostat with nvt_q: 43.06225052549201
preprocess frame /home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/torch/jit/_script.py 0 0x7f76d5ec71f0 get
bytecode to run:
0: JUMP_ABSOLUTE(12, 12) -> inst 6
1: LOAD_FAST(0, self)
2: LOAD_METHOD(0, getattr)
3: LOAD_CONST(0, forward)
4: CALL_METHOD(1, 1)
5: JUMP_ABSOLUTE(40, 40) -> inst 20
6: LOAD_GLOBAL(1, guard_match)
7: LOAD_CONST(2, 0)
8: LOAD_CONST(2, 0)
9: LOAD_GLOBAL(2, locals)
10: CALL_FUNCTION(0, 0)
11: CALL_FUNCTION(3, 3) # call guard_match(frame_id, callsite_id, locals)
12: UNPACK_SEQUENCE(2, 2)
13: STORE_FAST(3, __case_idx)
14: STORE_FAST(4, __graph_fn)
15: LOAD_GLOBAL(3, enable_trace)
16: LOAD_CONST(2, 0)
17: CALL_FUNCTION(1, 1)
18: POP_TOP(None, None)
19: JUMP_ABSOLUTE(2, 2) -> inst 1
20: LOAD_GLOBAL(4, disable_trace)
21: LOAD_CONST(2, 0)
22: CALL_FUNCTION(1, 1)
23: POP_TOP(None, None)
24: RETURN_VALUE(None, None)
INFO [_script.py:324] guard cache miss: frame_id 0 callsite_id 0
push tracker 0 frame 0x7f76d5ef35b0 frame_id 0 read_stack False cf_info <class 'NoneType'> all [0]
tracing opcode POP_TOP None pc=36 frame=0(0x7f76d5ef35b0)
restart: running injected code (f_lasti=36)
tracing opcode JUMP_ABSOLUTE None pc=38 frame=0(0x7f76d5ef35b0)
restart: running injected code (f_lasti=38)
tracing line /home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/torch/jit/_script.py:324
tracing opcode LOAD_FAST None pc=2 frame=0(0x7f76d5ef35b0)
tracing opcode LOAD_METHOD None pc=4 frame=0(0x7f76d5ef35b0)
AttributeError: '_CachedForward' object has no attribute 'getattr'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/worldpeace/soft/MagPy/frontend/guard_tracker.py", line 974, in record
getattr(self, inst.opname)(inst)
File "/home/worldpeace/soft/MagPy/frontend/guard_tracker.py", line 2223, in LOAD_METHOD
is_bound = is_bound_method(self_obj, inst.argval)
SystemError: returned a result with an error set
exception in trace_func: returned a result with an error set <class 'SystemError'>
AttributeError: '_CachedForward' object has no attribute 'getattr'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/worldpeace/soft/MagPy/frontend/tracer.py", line 34, in trace_func
record(frame, frame_id)
File "/home/worldpeace/soft/MagPy/frontend/guard_tracker.py", line 2827, in record
trackers[-1].record(frame, frame_id)
File "/home/worldpeace/soft/MagPy/frontend/guard_tracker.py", line 979, in record
raise e
File "/home/worldpeace/soft/MagPy/frontend/guard_tracker.py", line 974, in record
getattr(self, inst.opname)(inst)
File "/home/worldpeace/soft/MagPy/frontend/guard_tracker.py", line 2223, in LOAD_METHOD
is_bound = is_bound_method(self_obj, inst.argval)
SystemError: returned a result with an error set
code stack:
File "/home/worldpeace/ASE/model_run.py", line 187, in
main()
File "/home/worldpeace/ASE/model_run.py", line 159, in main
write_ase_md_config(curr_atoms=atoms, curr_step=0, dt=args.dt)
File "/home/worldpeace/ASE/model_run.py", line 59, in write_ase_md_config
forces = curr_atoms.get_forces()
File "/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/ase/atoms.py", line 827, in get_forces
forces = self._calc.get_forces(self)
File "/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/ase/calculators/abc.py", line 30, in get_forces
return self.get_property('forces', atoms)
File "/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/ase/calculators/calculator.py", line 538, in get_property
self.calculate(atoms, [name], system_changes)
File "/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/nequip/ase/nequip_calculator.py", line 128, in calculate
out = self.model(data)
File "/home/worldpeace/soft/MagPy/frontend/compile.py", line 73, in _fn
fn = f.forward if isinstance(f, torch.nn.Module) else f
File "/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/torch/jit/_script.py", line 324, in get
def get(self, obj, cls):
exception in _fn: returned a result with an error set <class 'SystemError'>
AttributeError: '_CachedForward' object has no attribute 'getattr'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/worldpeace/ASE/model_run.py", line 187, in
main()
File "/home/worldpeace/ASE/model_run.py", line 159, in main
write_ase_md_config(curr_atoms=atoms, curr_step=0, dt=args.dt)
File "/home/worldpeace/ASE/model_run.py", line 59, in write_ase_md_config
forces = curr_atoms.get_forces()
File "/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/ase/atoms.py", line 827, in get_forces
forces = self._calc.get_forces(self)
File "/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/ase/calculators/abc.py", line 30, in get_forces
return self.get_property('forces', atoms)
File "/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/ase/calculators/calculator.py", line 538, in get_property
self.calculate(atoms, [name], system_changes)
File "/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/nequip/ase/nequip_calculator.py", line 128, in calculate
out = self.model(data)
File "/home/worldpeace/soft/MagPy/frontend/compile.py", line 77, in _fn
raise e
File "/home/worldpeace/soft/MagPy/frontend/compile.py", line 73, in _fn
fn = f.forward if isinstance(f, torch.nn.Module) else f
File "/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/torch/jit/_script.py", line 325, in get
return self.getattr("forward") # type: ignore[attr-defined]
File "/home/worldpeace/anaconda3/envs/magpy/lib/python3.9/site-packages/torch/jit/_script.py", line 324, in get
def get(self, obj, cls):
File "/home/worldpeace/soft/MagPy/frontend/tracer.py", line 58, in trace_func
raise e
File "/home/worldpeace/soft/MagPy/frontend/tracer.py", line 34, in trace_func
record(frame, frame_id)
File "/home/worldpeace/soft/MagPy/frontend/guard_tracker.py", line 2827, in record
trackers[-1].record(frame, frame_id)
File "/home/worldpeace/soft/MagPy/frontend/guard_tracker.py", line 979, in record
raise e
File "/home/worldpeace/soft/MagPy/frontend/guard_tracker.py", line 974, in record
getattr(self, inst.opname)(inst)
File "/home/worldpeace/soft/MagPy/frontend/guard_tracker.py", line 2223, in LOAD_METHOD
is_bound = is_bound_method(self_obj, inst.argval)
SystemError: returned a result with an error set
used time:5s