ayaanzhaque / instruct-nerf2nerf

Instruct-NeRF2NeRF: Editing 3D Scenes with Instructions (ICCV 2023)
https://instruct-nerf2nerf.github.io/
MIT License
806 stars 73 forks source link

OverflowError: cannot fit 'int' into an index-sized integer #34

Closed 870223050 closed 1 year ago

870223050 commented 1 year ago

D:\anaconda\Anaconda3\envs\sdfstudio\lib\runpy.py:194 in _run_module_as_main │ │ │ │ 191 │ main_globals = sys.modules["main"].dict │ │ 192 │ if alter_argv: │ │ 193 │ │ sys.argv[0] = mod_spec.origin │ │ ❱ 194 │ return _run_code(code, main_globals, None, │ │ 195 │ │ │ │ │ "main", mod_spec) │ │ 196 │ │ 197 def run_module(mod_name, init_globals=None, │ │ │ │ D:\anaconda\Anaconda3\envs\sdfstudio\lib\runpy.py:87 in _run_code │ │ │ │ 84 │ │ │ │ │ loader = loader, │ │ 85 │ │ │ │ │ package = pkg_name, │ │ 86 │ │ │ │ │ spec = mod_spec) │ │ ❱ 87 │ exec(code, run_globals) │ │ 88 │ return run_globals │ │ 89 │ │ 90 def _run_module_code(code, init_globals=None, │ │ │ │ in :7 │ │ │ │ 4 from scripts.train import entrypoint │ │ 5 if name == 'main': │ │ 6 │ sys.argv[0] = re.sub(r'(-script.pyw|.exe)?$', '', sys.argv[0]) │ │ ❱ 7 │ sys.exit(entrypoint()) │ │ 8 │ │ │ │ D:\nerfstudio-main\scripts\train.py:247 in entrypoint │ │ │ │ 244 │ """Entrypoint for use with pyproject scripts.""" │ │ 245 │ # Choose a base configuration and override values. │ │ 246 │ tyro.extras.set_accent_color("bright_yellow") │ │ ❱ 247 │ main( │ │ 248 │ │ tyro.cli( │ │ 249 │ │ │ AnnotatedBaseConfigUnion, │ │ 250 │ │ │ description=convert_markup_to_ansi(doc), │ │ │ │ D:\nerfstudio-main\scripts\train.py:233 in main │ │ │ │ 230 │ config.print_to_terminal() │ │ 231 │ config.save_config() │ │ 232 │ │ │ ❱ 233 │ launch( │ │ 234 │ │ main_func=train_loop, │ │ 235 │ │ num_gpus_per_machine=config.machine.num_gpus, │ │ 236 │ │ num_machines=config.machine.num_machines, │ │ │ │ D:\nerfstudio-main\scripts\train.py:172 in launch │ │ │ │ 169 │ │ # world_size=0 uses one CPU in one process. │ │ 170 │ │ # world_size=1 uses one GPU in one process. │ │ 171 │ │ try: │ │ ❱ 172 │ │ │ main_func(local_rank=0, world_size=world_size, config=config) │ │ 173 │ │ except KeyboardInterrupt: │ │ 174 │ │ │ # print the stack trace │ │ 175 │ │ │ CONSOLE.print(traceback.format_exc()) │ │ │ │ D:\nerfstudio-main\scripts\train.py:86 in train_loop │ │ │ │ 83 │ """ │ │ 84 │ _set_random_seed(config.machine.seed + global_rank) │ │ 85 │ trainer = config.setup(local_rank=local_rank, world_size=world_size) │ │ ❱ 86 │ trainer.setup() │ │ 87 │ trainer.train() │ │ 88 │ │ 89 │ │ │ │ D:\nerfstudio-main\nerfstudio\engine\trainer.py:145 in setup │ │ │ │ 142 │ │ │ │ 'test': loads train/test datasets into memory │ │ 143 │ │ │ │ 'inference': does not load any dataset into memory │ │ 144 │ │ """ │ │ ❱ 145 │ │ self.pipeline = self.config.pipeline.setup( │ │ 146 │ │ │ device=self.device, test_mode=test_mode, world_size=self.world_size, local_r │ │ 147 │ │ ) │ │ 148 │ │ self.optimizers = self.setup_optimizers() │ │ │ │ D:\nerfstudio-main\nerfstudio\configs\base_config.py:60 in setup │ │ │ │ 57 │ │ │ 58 │ def setup(self, kwargs) -> Any: │ │ 59 │ │ """Returns the instantiated object using the config.""" │ │ ❱ 60 │ │ return self._target(self, kwargs) │ │ 61 │ │ 62 │ │ 63 # Machine related configs │ │ │ │ D:\nerf2nerf\in2n\in2n_pipeline.py:84 in init │ │ │ │ 81 │ │ self.ip2p = InstructPix2Pix(self.ip2p_device, ip2p_use_full_precision=self.confi │ │ 82 │ │ │ │ 83 │ │ # load base text embedding using classifier free guidance │ │ ❱ 84 │ │ self.text_embedding = self.ip2p.pipe._encode_prompt( │ │ 85 │ │ │ self.config.prompt, device=self.ip2p_device, num_images_per_prompt=1, do_cla │ │ 86 │ │ ) │ │ 87 │ │ │ │ D:\anaconda\Anaconda3\envs\sdfstudio\lib\site-packages\diffusers\pipelines\stable_diffusion\pipe │ │ line_stable_diffusion_instruct_pix2pix.py:519 in _encode_prompt │ │ │ │ 516 │ │ │ if isinstance(self, TextualInversionLoaderMixin): │ │ 517 │ │ │ │ prompt = self.maybe_convert_prompt(prompt, self.tokenizer) │ │ 518 │ │ │ │ │ ❱ 519 │ │ │ text_inputs = self.tokenizer( │ │ 520 │ │ │ │ prompt, │ │ 521 │ │ │ │ padding="max_length", │ │ 522 │ │ │ │ max_length=self.tokenizer.model_max_length, │ │ │ │ D:\anaconda\Anaconda3\envs\sdfstudio\lib\site-packages\transformers\tokenization_utils_base.py:2 │ │ 538 in call │ │ │ │ 2535 │ │ │ # input mode in this case. │ │ 2536 │ │ │ if not self._in_target_context_manager: │ │ 2537 │ │ │ │ self._switch_to_input_mode() │ │ ❱ 2538 │ │ │ encodings = self._call_one(text=text, text_pair=text_pair, all_kwargs) │ │ 2539 │ │ if text_target is not None: │ │ 2540 │ │ │ self._switch_to_target_mode() │ │ 2541 │ │ │ target_encodings = self._call_one(text=text_target, text_pair=text_pair_targ │ │ │ │ D:\anaconda\Anaconda3\envs\sdfstudio\lib\site-packages\transformers\tokenization_utils_base.py:2 │ │ 644 in _call_one │ │ │ │ 2641 │ │ │ │ kwargs, │ │ 2642 │ │ │ ) │ │ 2643 │ │ else: │ │ ❱ 2644 │ │ │ return self.encode_plus( │ │ 2645 │ │ │ │ text=text, │ │ 2646 │ │ │ │ text_pair=text_pair, │ │ 2647 │ │ │ │ add_special_tokens=add_special_tokens, │ │ │ │ D:\anaconda\Anaconda3\envs\sdfstudio\lib\site-packages\transformers\tokenization_utils_base.py:2 │ │ 717 in encode_plus │ │ │ │ 2714 │ │ │ *kwargs, │ │ 2715 │ │ ) │ │ 2716 │ │ │ │ ❱ 2717 │ │ return self._encode_plus( │ │ 2718 │ │ │ text=text, │ │ 2719 │ │ │ text_pair=text_pair, │ │ 2720 │ │ │ add_special_tokens=add_special_tokens, │ │ │ │ D:\anaconda\Anaconda3\envs\sdfstudio\lib\site-packages\transformers\tokenization_utils.py:652 in │ │ _encode_plus │ │ │ │ 649 │ │ first_ids = get_input_ids(text) │ │ 650 │ │ second_ids = get_input_ids(text_pair) if text_pair is not None else None │ │ 651 │ │ │ │ ❱ 652 │ │ return self.prepare_for_model( │ │ 653 │ │ │ first_ids, │ │ 654 │ │ │ pair_ids=second_ids, │ │ 655 │ │ │ add_special_tokens=add_special_tokens, │ │ │ │ D:\anaconda\Anaconda3\envs\sdfstudio\lib\site-packages\transformers\tokenization_utils_base.py:3 │ │ 196 in prepare_for_model │ │ │ │ 3193 │ │ │ │ 3194 │ │ # Padding │ │ 3195 │ │ if padding_strategy != PaddingStrategy.DO_NOT_PAD or return_attention_mask: │ │ ❱ 3196 │ │ │ encoded_inputs = self.pad( │ │ 3197 │ │ │ │ encoded_inputs, │ │ 3198 │ │ │ │ max_length=max_length, │ │ 3199 │ │ │ │ padding=padding_strategy.value, │ │ │ │ D:\anaconda\Anaconda3\envs\sdfstudio\lib\site-packages\transformers\tokenization_utils_base.py:3 │ │ 001 in pad │ │ │ │ 2998 │ │ │ │ 2999 │ │ required_input = encoded_inputs[self.model_input_names[0]] │ │ 3000 │ │ if required_input and not isinstance(required_input[0], (list, tuple)): │ │ ❱ 3001 │ │ │ encoded_inputs = self._pad( │ │ 3002 │ │ │ │ encoded_inputs, │ │ 3003 │ │ │ │ max_length=max_length, │ │ 3004 │ │ │ │ padding_strategy=padding_strategy, │ │ │ │ D:\anaconda\Anaconda3\envs\sdfstudio\lib\site-packages\transformers\tokenization_utils_base.py:3 │ │ 386 in _pad │ │ │ │ 3383 │ │ │ │ │ 3384 │ │ │ if self.padding_side == "right": │ │ 3385 │ │ │ │ if return_attention_mask: │ │ ❱ 3386 │ │ │ │ │ encoded_inputs["attention_mask"] = encoded_inputs["attention_mask"] │ │ 3387 │ │ │ │ if "token_type_ids" in encoded_inputs: │ │ 3388 │ │ │ │ │ encoded_inputs["token_type_ids"] = ( │ │ 3389 │ │ │ │ │ │ encoded_inputs["token_type_ids"] + [self.pad_token_type_id] di │

OverflowError: cannot fit 'int' into an index-sized integer

870223050 commented 1 year ago

Thanks for your work, I reported the following error after running the in2n model: OverflowError: cannot fit 'int' into an index-sized integer。The command I entered is: ns-train in2n-tiny --data \bear --load-dir \sdfstudio-master\outputs\bear\nerfacto\2023-05-21_215614\nerfstudio_models --pipeline.prompt "Turn the bear into a grizzly bear" --pipeline.guidance-scale 7.5 --pipeline.image-guidance-scale 1.5 nerfstudio-data --downscale-factor 8 .Am I missing something?

ayaanzhaque commented 1 year ago

Can you try using a downscale factor of 2?

870223050 commented 1 year ago

I tried, but it still didn't work. My graphics card is 3070ti, my system is Windows 10, and my CUDA is 11.8. It was normal for me to train NeLaco on this, but I ran into some issues with training n2n,and in2n-small.

ayaanzhaque commented 1 year ago

Can you show me at what line this error occurs?

870223050 commented 1 year ago

See figure below for https://img1.imgtp.com/2023/06/05/DA0k2SBC.png https://img1.imgtp.com/2023/06/05/CK7uUhNp.png

ayaanzhaque commented 1 year ago

I see, I'm pretty confused by this error, seems like an issue with the text encoder. Does this issue happen with just the bear dataset?

870223050 commented 1 year ago

I'm having the same issue with fangzhou-small, face, as well as homemade datasets

870223050 commented 1 year ago

I did debug the code and found that the value here is large, 1000000000000000019884624838656. https://img1.imgtp.com/2023/06/05/qG9tIuHN.jpg https://img1.imgtp.com/2023/06/05/TnlcwmJ2.jpg https://img1.imgtp.com/2023/06/05/1Alrjl82.jpg

ayaanzhaque commented 1 year ago

I see. Maybe it is an issue with your install? Can you wipe your conda environment and re-install it?

870223050 commented 1 year ago

Thanks for your reply, I reinstalled on another machine and fixed the problem.

CSUXA commented 1 week ago

Thanks for your reply, I reinstalled on another machine and fixed the problem Excuse me,i'm also experiencing this issue.Do you know why this error is occurring,and can reinstalling the conda environment really solve the problem?