Skip to content

[Bugfix] Fix sliding window in cohere2 model #11358

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

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion vllm/model_executor/models/commandr.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

# This file is based on the LLama model definition file in transformers
"""PyTorch Cohere model."""
import copy
from typing import Iterable, List, Optional, Set, Tuple, Union

import torch
Expand Down Expand Up @@ -183,14 +184,15 @@ def __init__(

self.sliding_window = (sliding_window
if layer_has_sliding_window else None)
cache_config = copy.deepcopy(cache_config)
cache_config.sliding_window = self.sliding_window

self.attn = Attention(self.num_heads,
self.head_dim,
self.scaling,
num_kv_heads=self.num_kv_heads,
cache_config=cache_config,
quant_config=quant_config,
per_layer_sliding_window=self.sliding_window,
prefix=f"{prefix}.attn")
if self.use_qk_norm:
self.q_norm = LayerNorm(param_shape=(self.num_heads,
Expand Down
Loading