-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dimension error #90
Comments
Download |
1 similar comment
Download |
用sam2_hiera_large.pt的模型可以跑通,但是训练完保存下来的模型好像还是跑不通 |
请问,你解决这个问题了吗?我也遇到了。用的也是sam2_hiera_large.pt的模型 |
|
@Stangerine 我在使用 batch 为 1 的时候也遇到这个错误,通过修改 models/sam.py 下面的代码可以解决,你看和我情况一样不一样
|
只能改为2吗?如果我想批次是16或32会报错,怎么办? |
@shidizai-swpu 你可以将 bs 修改为 batch size 的值,我的显存只够 bs=1 能够运行,所以才改为 1 |
/home/a/miniconda3/envs/zzq_sot/lib/python3.10/site-packages/mmcv/init.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details.
warnings.warn(
config loaded.
train dataset: size=37
inp: shape=(3, 1024, 1024)
gt: shape=(1, 1024, 1024)
val dataset: size=24
inp: shape=(3, 1024, 1024)
gt: shape=(1, 1024, 1024)
inp_rgb: shape=(3, 1024, 1024)
model: #params=224.5M
model_grad_params: 3943789
model_total_params: 224512925
model_grad_params: 3943789
train: 0%| | 0/37 [00:00<?, ?it/s]Traceback (most recent call last):
File "/data/zzq/object_tracking/SAM-Adapter-PyTorch/train.py", line 257, in
main(config, save_path)
File "/data/zzq/object_tracking/SAM-Adapter-PyTorch/train.py", line 175, in main
train_loss_G = train(train_loader, model)
File "/data/zzq/object_tracking/SAM-Adapter-PyTorch/train.py", line 123, in train
model.optimize_parameters()
File "/data/zzq/object_tracking/SAM-Adapter-PyTorch/models/sam.py", line 395, in optimize_parameters
self.forward()
File "/data/zzq/object_tracking/SAM-Adapter-PyTorch/models/sam.py", line 245, in forward
low_res_masks, iou_predictions,sam_output_tokens,object_score_logits, = self.mask_decoder(
File "/home/a/miniconda3/envs/zzq_sot/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/a/miniconda3/envs/zzq_sot/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File "/data/zzq/object_tracking/SAM-Adapter-PyTorch/models/mmseg/models/sam/mask_decoder.py", line 137, in forward
masks, iou_pred, mask_tokens_out, object_score_logits = self.predict_masks(
File "/data/zzq/object_tracking/SAM-Adapter-PyTorch/models/mmseg/models/sam/mask_decoder.py", line 207, in predict_masks
src = src + dense_prompt_embeddings
RuntimeError: The size of tensor a (128) must match the size of tensor b (256) at non-singleton dimension 1
The text was updated successfully, but these errors were encountered: