Skip to content

Commit

Permalink
[VLM] Fix paligemma, fuyu and persimmon with transformers 4.45 : use …
Browse files Browse the repository at this point in the history
…config.text_config.vocab_size (vllm-project#8707)
  • Loading branch information
janimo authored and MengqingCao committed Sep 30, 2024
1 parent 5b99fe2 commit bce54a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion vllm/model_executor/models/fuyu.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def __init__(self,
self.multimodal_config = multimodal_config

self.padding_idx = config.pad_token_id
self.vocab_size = config.vocab_size
self.vocab_size = config.text_config.vocab_size
self.image_token_id = _IMAGE_TOKEN_ID
self.image_feature_size = config.patch_size**2 * config.num_channels

Expand Down
3 changes: 2 additions & 1 deletion vllm/model_executor/models/paligemma.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def __init__(self,
self.unpadded_vocab_size = config.text_config.vocab_size
logit_scale = getattr(config, "logit_scale", 1.0)
self.logits_processor = LogitsProcessor(self.unpadded_vocab_size,
config.vocab_size, logit_scale)
config.text_config.vocab_size,
logit_scale)
self.sampler = Sampler()

def _validate_pixel_values(self, data: torch.Tensor) -> torch.Tensor:
Expand Down
12 changes: 6 additions & 6 deletions vllm/model_executor/models/persimmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ def __init__(self,
cache_config: Optional[CacheConfig] = None,
quant_config: Optional[QuantizationConfig] = None):
super().__init__()
self.vocab_size = config.vocab_size
self.vocab_size = config.text_config.vocab_size

self.embed_tokens = VocabParallelEmbedding(config.vocab_size,
config.hidden_size)
self.embed_tokens = VocabParallelEmbedding(
config.text_config.vocab_size, config.hidden_size)
self.layers = nn.ModuleList([
PersimmonDecoderLayer(config,
cache_config=cache_config,
Expand Down Expand Up @@ -257,14 +257,14 @@ def __init__(self,
quant_config: Optional[QuantizationConfig] = None):
super().__init__()
self.config = config
self.vocab_size = config.vocab_size
self.vocab_size = config.text_config.vocab_size
self.model = PersimmonModel(config,
cache_config=cache_config,
quant_config=quant_config)
self.lm_head = ParallelLMHead(config.vocab_size,
self.lm_head = ParallelLMHead(config.text_config.vocab_size,
config.hidden_size,
bias=False)
self.logits_processor = LogitsProcessor(config.vocab_size)
self.logits_processor = LogitsProcessor(config.text_config.vocab_size)
self.sampler = Sampler()

def forward(
Expand Down

0 comments on commit bce54a6

Please sign in to comment.