Skip to content

RuntimeError: The expanded size of the tensor (16) must match the existing size (4) at non-singleton dimension 2 #37

@Akshad-meta

Description

@Akshad-meta

While running this code,

ns-train gaussctrl --load-checkpoint unedited_models/bear/splatfacto/2026-01-05_095609/nerfstudio_models/step-000029999.ckpt --experiment-name bear --output-dir outputs --pipeline.datamanager.data data/bear --pipeline.edit_prompt "a photo of a polar bear in the forest" --pipeline.reverse_prompt "a photo of a bear statue in the forest" --pipeline.guidance_scale 5 --pipeline.chunk_size 3 --pipeline.langsam_obj 'bear' --viewer.quit-on-train-completion True

I am facing this issue

Traceback (most recent call last):
File "/opt/conda/envs/gaussctrl/bin/ns-train", line 7, in
sys.exit(entrypoint())
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/nerfstudio/scripts/train.py", line 262, in entrypoint
main(
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/nerfstudio/scripts/train.py", line 247, in main
launch(
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/nerfstudio/scripts/train.py", line 189, in launch
main_func(local_rank=0, world_size=world_size, config=config)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/nerfstudio/scripts/train.py", line 99, in train_loop
trainer.setup()
File "/home/akshadshyam/DECO/normal/gaussctrl/gaussctrl/gc_trainer.py", line 76, in setup
self.pipeline.render_reverse()
File "/home/akshadshyam/DECO/normal/gaussctrl/gaussctrl/gc_pipeline.py", line 151, in render_reverse
masks, _, _, _ = self.langsam.predict(langsam_rgb_pil, langsam_obj)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/lang_sam/lang_sam.py", line 44, in predict
gdino_results = self.gdino.predict(images_pil, texts_prompt, box_threshold, text_threshold)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/lang_sam/models/gdino.py", line 43, in predict
outputs = self.model(**inputs)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
return forward_call(*args, **kwargs)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/transformers/models/grounding_dino/modeling_grounding_dino.py", line 2532, in forward
outputs = self.model(
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
return forward_call(*args, **kwargs)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/transformers/models/grounding_dino/modeling_grounding_dino.py", line 2194, in forward
encoder_outputs = self.encoder(
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
return forward_call(*args, **kwargs)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/transformers/models/grounding_dino/modeling_grounding_dino.py", line 1583, in forward
(vision_features, text_features), attentions = encoder_layer(
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
return forward_call(*args, **kwargs)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/transformers/models/grounding_dino/modeling_grounding_dino.py", line 1133, in forward
(vision_features, vision_fused_attn), (text_features, text_fused_attn) = self.fusion_layer(
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
return forward_call(*args, **kwargs)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/transformers/models/grounding_dino/modeling_grounding_dino.py", line 949, in forward
(delta_v, vision_attn), (delta_t, text_attn) = self.attn(
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1786, in call_impl
return forward_call(*args, **kwargs)
File "/opt/conda/envs/gaussctrl/lib/python3.10/site-packages/transformers/models/grounding_dino/modeling_grounding_dino.py", line 829, in forward
attn_weights.masked_fill
(text_attention_mask, float("-inf"))
RuntimeError: The expanded size of the tensor (16) must match the existing size (4) at non-singleton dimension 2. Target sizes: [4, 13294, 16]. Tensor sizes: [16, 1, 4]

My environment specs:
name: gaussctrl
channels:

  • nvidia/label/cuda-11.8.0
  • conda-forge
    dependencies:
  • _libgcc_mutex=0.1=conda_forge
  • _openmp_mutex=4.5=2_gnu
  • bzip2=1.0.8=hda65f42_8
  • ca-certificates=2026.1.4=hbd8a1cb_0
  • cuda=11.8.0=0
  • cuda-cccl=11.8.89=0
  • cuda-command-line-tools=11.8.0=0
  • cuda-compiler=11.8.0=0
  • cuda-cudart=11.8.89=0
  • cuda-cudart-dev=11.8.89=0
  • cuda-cuobjdump=11.8.86=0
  • cuda-cupti=11.8.87=0
  • cuda-cuxxfilt=11.8.86=0
  • cuda-demo-suite=11.8.86=0
  • cuda-documentation=11.8.86=0
  • cuda-driver-dev=11.8.89=0
  • cuda-gdb=11.8.86=0
  • cuda-libraries=11.8.0=0
  • cuda-libraries-dev=11.8.0=0
  • cuda-memcheck=11.8.86=0
  • cuda-nsight=11.8.86=0
  • cuda-nsight-compute=11.8.0=0
  • cuda-nvcc=11.8.89=0
  • cuda-nvdisasm=11.8.86=0
  • cuda-nvml-dev=11.8.86=0
  • cuda-nvprof=11.8.87=0
  • cuda-nvprune=11.8.86=0
  • cuda-nvrtc=11.8.89=0
  • cuda-nvrtc-dev=11.8.89=0
  • cuda-nvtx=11.8.86=0
  • cuda-nvvp=11.8.87=0
  • cuda-profiler-api=11.8.86=0
  • cuda-runtime=11.8.0=0
  • cuda-sanitizer-api=11.8.86=0
  • cuda-toolkit=11.8.0=0
  • cuda-tools=11.8.0=0
  • cuda-visual-tools=11.8.0=0
  • gds-tools=1.4.0.31=0
  • icu=78.1=h33c6efd_0
  • ld_impl_linux-64=2.45=default_hbd61a6d_105
  • libcublas=11.11.3.6=0
  • libcublas-dev=11.11.3.6=0
  • libcufft=10.9.0.58=0
  • libcufft-dev=10.9.0.58=0
  • libcufile=1.4.0.31=0
  • libcufile-dev=1.4.0.31=0
  • libcurand=10.3.0.86=0
  • libcurand-dev=10.3.0.86=0
  • libcusolver=11.4.1.48=0
  • libcusolver-dev=11.4.1.48=0
  • libcusparse=11.7.5.86=0
  • libcusparse-dev=11.7.5.86=0
  • libexpat=2.7.3=hecca717_0
  • libffi=3.5.2=h9ec8514_0
  • libgcc=15.2.0=he0feb66_16
  • libgcc-ng=15.2.0=h69a702a_16
  • libgomp=15.2.0=he0feb66_16
  • liblzma=5.8.1=hb9d3cd8_2
  • libnpp=11.8.0.86=0
  • libnpp-dev=11.8.0.86=0
  • libnsl=2.0.1=hb9d3cd8_1
  • libnvjpeg=11.9.0.86=0
  • libnvjpeg-dev=11.9.0.86=0
  • libsqlite=3.51.1=hf4e2dac_1
  • libstdcxx=15.2.0=h934c35e_16
  • libuuid=2.41.3=h5347b49_0
  • libxcrypt=4.4.36=hd590300_1
  • libzlib=1.3.1=hb9d3cd8_2
  • ncurses=6.5=h2d0b736_3
  • nsight-compute=2022.3.0.22=0
  • openssl=3.6.0=h26f9b46_0
  • pip=25.3=pyh8b19718_0
  • python=3.10.19=h3c07f61_2_cpython
  • readline=8.3=h853b02a_0
  • setuptools=80.9.0=pyhff2d567_0
  • tk=8.6.13=noxft_ha0e22de_103
  • wheel=0.45.1=pyhd8ed1ab_1
  • zstd=1.5.7=hb78ec9c_6
  • pip:
    • absl-py==2.3.1
    • accelerate==1.12.0
    • addict==2.4.0
    • aiofiles==24.1.0
    • annotated-doc==0.0.4
    • annotated-types==0.7.0
    • antlr4-python3-runtime==4.9.3
    • anyio==4.12.0
    • appdirs==1.4.4
    • argon2-cffi==25.1.0
    • argon2-cffi-bindings==25.1.0
    • arrow==1.4.0
    • async-lru==2.0.5
    • attrs==25.4.0
    • av==16.0.1
    • awscli==1.44.11
    • babel==2.17.0
    • beautifulsoup4==4.14.3
    • bidict==0.23.1
    • bleach==6.3.0
    • blinker==1.9.0
    • botocore==1.42.21
    • brotli==1.2.0
    • cachetools==6.2.4
    • certifi==2026.1.4
    • cffi==2.0.0
    • charset-normalizer==3.4.4
    • click==8.3.1
    • clip==1.0
    • colorama==0.4.6
    • colorlog==6.10.1
    • comet-ml==3.55.0
    • configargparse==1.7.1
    • configobj==5.0.9
    • contourpy==1.3.2
    • cryptography==46.0.3
    • cycler==0.12.1
    • dash==3.3.0
    • decorator==5.2.1
    • defusedxml==0.7.1
    • descartes==1.1.0
    • diffusers==0.36.0
    • dill==0.4.0
    • docstring-parser==0.17.0
    • docutils==0.19
    • dulwich==0.25.0
    • einops==0.8.1
    • embreex==2.17.7.post7
    • everett==3.1.0
    • fastapi==0.128.0
    • fastjsonschema==2.21.2
    • ffmpy==1.0.0
    • filelock==3.20.2
    • fire==0.7.1
    • flask==3.1.2
    • fonttools==4.61.1
    • fqdn==1.5.1
    • fsspec==2025.12.0
    • ftfy==6.3.1
    • gaussctrl==0.1.0
    • gdown==5.2.0
    • gitdb==4.0.12
    • gitpython==3.1.46
    • gradio==6.2.0
    • gradio-client==2.0.2
    • groovy==0.1.2
    • grpcio==1.76.0
    • gsplat==0.1.3
    • h11==0.16.0
    • h5py==3.15.1
    • hf-xet==1.2.0
    • httpcore==1.0.9
    • httptools==0.7.1
    • httpx==0.28.1
    • huggingface-hub==0.36.0
    • hydra-core==1.3.2
    • idna==3.11
    • imageio==2.37.2
    • importlib-metadata==8.7.1
    • iopath==0.1.10
    • ipywidgets==8.1.8
    • isoduration==20.11.0
    • itsdangerous==2.2.0
    • jaxtyping==0.3.4
    • jinja2==3.1.6
    • jmespath==1.0.1
    • joblib==1.5.3
    • json5==0.13.0
    • jsonpointer==3.0.0
    • jsonschema==4.25.1
    • jsonschema-specifications==2025.9.1
    • jupyter-events==0.12.0
    • jupyter-lsp==2.3.0
    • jupyter-server==2.17.0
    • jupyter-server-terminals==0.5.3
    • jupyterlab==4.5.1
    • jupyterlab-pygments==0.3.0
    • jupyterlab-server==2.28.0
    • jupyterlab-widgets==3.0.16
    • kiwisolver==1.4.9
    • lang-sam==0.2.1
    • lark==1.3.1
    • lazy-loader==0.4
    • lightning-utilities==0.15.2
    • litserve==0.2.17
    • lxml==6.0.2
    • manifold3d==3.3.2
    • mapbox-earcut==2.0.0
    • markdown==3.10
    • markdown-it-py==4.0.0
    • markupsafe==3.0.3
    • matplotlib==3.10.8
    • mdurl==0.1.2
    • mediapy==1.2.5
    • mistune==3.2.0
    • mpmath==1.3.0
    • msgpack==1.1.2
    • msgpack-numpy==0.4.8
    • multiprocess==0.70.18
    • narwhals==2.14.0
    • nbclient==0.10.4
    • nbconvert==7.16.6
    • nbformat==5.10.4
    • nerfacc==0.5.2
    • nerfstudio==1.0.0
    • networkx==3.4.2
    • ninja==1.13.0
    • nodeenv==1.10.0
    • notebook-shim==0.2.4
    • numpy==1.26.4
    • nuscenes-devkit==1.2.0
    • nvidia-cublas-cu12==12.8.4.1
    • nvidia-cuda-cupti-cu12==12.8.90
    • nvidia-cuda-nvrtc-cu12==12.8.93
    • nvidia-cuda-runtime-cu12==12.8.90
    • nvidia-cudnn-cu12==9.10.2.21
    • nvidia-cufft-cu12==11.3.3.83
    • nvidia-cufile-cu12==1.13.1.3
    • nvidia-curand-cu12==10.3.9.90
    • nvidia-cusolver-cu12==11.7.3.90
    • nvidia-cusparse-cu12==12.5.8.93
    • nvidia-cusparselt-cu12==0.7.1
    • nvidia-nccl-cu12==2.27.5
    • nvidia-nvjitlink-cu12==12.8.93
    • nvidia-nvshmem-cu12==3.3.20
    • nvidia-nvtx-cu12==12.8.90
    • omegaconf==2.3.0
    • open3d==0.19.0
    • opencv-python==4.8.0.76
    • opencv-python-headless==4.11.0.86
    • orjson==3.11.5
    • overrides==7.7.0
    • packaging==25.0
    • pandas==2.3.3
    • pandocfilters==1.5.1
    • parameterized==0.9.0
    • pathos==0.3.4
    • pillow==12.1.0
    • platformdirs==4.5.1
    • plotly==6.5.0
    • portalocker==3.2.0
    • pox==0.3.6
    • ppft==1.7.7
    • prometheus-client==0.23.1
    • protobuf==3.20.3
    • psutil==7.2.1
    • pyasn1==0.6.1
    • pycocotools==2.0.11
    • pycollada==0.9.2
    • pycparser==2.23
    • pydantic==2.12.5
    • pydantic-core==2.41.5
    • pydub==0.25.1
    • pygments==2.19.2
    • pyliblzfse==0.4.1
    • pymeshlab==2023.12.post3
    • pyngrok==7.5.0
    • pyparsing==3.3.1
    • pyquaternion==0.9.9
    • pysocks==1.7.1
    • python-box==6.1.0
    • python-dateutil==2.9.0.post0
    • python-dotenv==1.2.1
    • python-engineio==4.13.0
    • python-json-logger==4.0.0
    • python-multipart==0.0.21
    • python-socketio==5.16.0
    • pytorch-msssim==1.0.0
    • pytz==2025.2
    • pyyaml==6.0.3
    • pyzmq==27.1.0
    • rawpy==0.25.1
    • referencing==0.37.0
    • regex==2025.11.3
    • requests==2.32.5
    • requests-toolbelt==1.0.0
    • retrying==1.4.2
    • rfc3339-validator==0.1.4
    • rfc3986-validator==0.1.1
    • rfc3987-syntax==1.1.0
    • rich==14.2.0
    • rpds-py==0.30.0
    • rsa==4.7.2
    • rtree==1.4.1
    • s3transfer==0.16.0
    • safehttpx==0.1.7
    • safetensors==0.7.0
    • sam-2==1.0
    • scikit-image==0.25.2
    • scikit-learn==1.7.2
    • scipy==1.15.3
    • semantic-version==2.10.0
    • send2trash==2.0.0
    • sentry-sdk==2.48.0
    • shapely==2.0.7
    • shellingham==1.5.4
    • simple-websocket==1.1.0
    • simplejson==3.20.2
    • six==1.17.0
    • smmap==5.0.2
    • soupsieve==2.8.1
    • splines==0.3.0
    • starlette==0.50.0
    • supervision==0.27.0
    • svg-path==7.0
    • sympy==1.14.0
    • tensorboard==2.20.0
    • tensorboard-data-server==0.7.2
    • termcolor==3.3.0
    • terminado==0.18.1
    • threadpoolctl==3.6.0
    • tifffile==2025.5.10
    • timm==0.6.7
    • tinycss2==1.4.0
    • tokenizers==0.22.1
    • tomli==2.3.0
    • tomlkit==0.13.3
    • torch==2.9.1
    • torch-fidelity==0.3.0
    • torchmetrics==1.8.2
    • torchvision==0.24.1
    • tqdm==4.67.1
    • transformers==4.57.3
    • trimesh==4.10.1
    • triton==3.5.1
    • typeguard==4.4.4
    • typer==0.21.0
    • typing-extensions==4.15.0
    • typing-inspection==0.4.2
    • tyro==1.0.3
    • tzdata==2025.3
    • uri-template==1.3.0
    • urllib3==2.6.2
    • uvicorn==0.40.0
    • uvloop==0.22.1
    • vhacdx==0.0.10
    • viser==0.1.21
    • wadler-lindig==0.1.7
    • wandb==0.23.1
    • watchfiles==1.1.1
    • webcolors==25.10.0
    • webencodings==0.5.1
    • websocket-client==1.9.0
    • websockets==15.0.1
    • werkzeug==3.1.4
    • widgetsnbextension==4.0.15
    • wrapt==2.0.1
    • wsproto==1.3.2
    • wurlitzer==3.1.1
    • xatlas==0.0.11
    • xxhash==3.6.0
    • yourdfpy==0.0.58
    • zipp==3.23.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions