Skip to content
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

[Bug] assert pad >= 0 failed when inter_size is not a multiple of group_size #2739

Closed
3 tasks done
Vinkle-hzt opened this issue Nov 12, 2024 · 0 comments · Fixed by #2740
Closed
3 tasks done

[Bug] assert pad >= 0 failed when inter_size is not a multiple of group_size #2739

Vinkle-hzt opened this issue Nov 12, 2024 · 0 comments · Fixed by #2740

Comments

@Vinkle-hzt
Copy link
Contributor

Vinkle-hzt commented Nov 12, 2024

Checklist

  • 1. I have searched related issues but cannot get the expected help.
  • 2. The bug has not been fixed in the latest version.
  • 3. Please note that if the bug-related issue you submitted lacks corresponding environment info and a minimal reproducible demo, it will be challenging for us to reproduce and resolve the issue, reducing the likelihood of receiving feedback.

Describe the bug

When inter_size=4505, the padding size will be 4480.

# https://github.com/InternLM/lmdeploy/blob/main/lmdeploy/turbomind/deploy/module.py#L47
def pad_out_dims(x: torch.Tensor, dims: int):
    pad = dims - x.size(-1)
    assert pad >= 0 # ERROR: dim=4480, x.size(-1)=4505
    return torch.nn.functional.pad(x, (0, pad), 'constant', 0)

Reproduction

Sorry for not providing the specific model that led to the issue, as I am currently utilizing a non-publicly available pruned model.
Below is the configuration that triggers this bug:

{
  "aligner_config": {
    "cls": "MlpProjector",
    "model_type": "aligner",
    "params": {
      "depth": 2,
      "input_dim": 1024,
      "n_embed": 2048,
      "projector_type": "mlp_gelu"
    }
  },
  "architectures": [
    "MultiModalityCausalLM"
  ],
  "language_config": {
    "hidden_size": 2048,
    "intermediate_size": 4505,
    "max_position_embeddings": 16384,
    "model_type": "llama",
    "num_attention_heads": 16,
    "num_hidden_layers": 24,
    "num_key_value_heads": 16,
    "torch_dtype": "float16",
    "vocab_size": 102400
  },
  "model_type": "multi_modality",
  "torch_dtype": "float16",
  "transformers_version": "4.38.2",
  "vision_config": {
    "cls": "CLIPVisionTower",
    "model_type": "vision",
    "params": {
      "image_size": 384,
      "model_name": "siglip_large_patch16_384",
      "pixel_mean": [
        0.5,
        0.5,
        0.5
      ],
      "pixel_std": [
        0.5,
        0.5,
        0.5
      ],
      "select_feature": "same",
      "select_layer": -1
    }
  }
}

Environment

model: a pruned deepseek-vl-1.3B model with an "intermediate_size" of 4505

lmdeploy version:
lmdeploy==0.6.2.post1

Error traceback

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant