cassiePython / NeRF-Art

NeRF-Art: Text-Driven Neural Radiance Fields Stylization
MIT License
157 stars 11 forks source link

Method 'forward' is not defined. #8

Closed nihao-eng closed 1 year ago

nihao-eng commented 1 year ago

Hello, when I run render.py and train, it gives me an error message saying "Method 'forward' is not defined."

Could you please let me know what could be causing this issue?

Traceback (most recent call last): File "/home/sda/cv3d/anaconda3/envs/xkuo_nerfart2/lib/python3.8/runpy.py", line 192, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/sda/cv3d/anaconda3/envs/xkuo_nerfart2/lib/python3.8/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/sda/cv3d/xkuo/NeRF-Art/train.py", line 342, in main_function(config) File "/home/sda/cv3d/xkuo/NeRF-Art/train.py", line 100, in main_function model, trainer, render_kwargs_train, render_kwargs_test, volume_render_fn = get_model(args,target_hw) File "/home/sda/cv3d/xkuo/NeRF-Art/models/frameworks/init.py", line 11, in get_model return get_model(args,target_hw) File "/home/sda/cv3d/xkuo/NeRF-Art/models/frameworks/volsdf.py", line 992, in get_model trainer = Trainer(model, args.device_ids, batched=render_kwargs_train['batched'],is_finetune = args.training.is_finetune,target_hw=render_target) File "/home/sda/cv3d/xkuo/NeRF-Art/models/frameworks/volsdf.py", line 639, in init contrastive_loss = ContrastiveLoss() File "/home/sda/cv3d/xkuo/NeRF-Art/criteria/contrastive_loss.py", line 97, in init self.model, clip_preprocess = clip.load("ViT-B/32", device="cuda") File "/home/sda/cv3d/anaconda3/envs/xkuo_nerfart2/lib/python3.8/site-packages/clip/clip.py", line 133, in load model.apply(patch_device) File "/home/sda/cv3d/anaconda3/envs/xkuo_nerfart2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 473, in apply module.apply(fn) File "/home/sda/cv3d/anaconda3/envs/xkuo_nerfart2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 473, in apply module.apply(fn) File "/home/sda/cv3d/anaconda3/envs/xkuo_nerfart2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 473, in apply module.apply(fn) [Previous line repeated 3 more times] File "/home/sda/cv3d/anaconda3/envs/xkuo_nerfart2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 474, in apply fn(self) File "/home/sda/cv3d/anaconda3/envs/xkuo_nerfart2/lib/python3.8/site-packages/clip/clip.py", line 124, in patch_device graphs = [module.graph] if hasattr(module, "graph") else [] File "/home/sda/cv3d/anaconda3/envs/xkuo_nerfart2/lib/python3.8/site-packages/torch/jit/_script.py", line 449, in graph return self._c._get_method("forward").graph RuntimeError: Method 'forward' is not defined.

cassiePython commented 1 year ago

It appears that your CLIP installation may not be correct. To resolve this issue, you can attempt to reinstall it by following the instructions provided at https://github.com/openai/CLIP

nihao-eng commented 1 year ago

您的 CLIP 安装可能不正确。要解决此问题,您可以按照https://github.com/openai/CLIP中提供的说明尝试重新安装它

Thanks, I have solved this problem