Skip to content

Commit

Permalink
fix: adjust ruff lints and small refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
drbh committed Jan 7, 2025
1 parent d397748 commit 78004db
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def __init__(self, prefix: str, config, weights, name=None):
if embedding_multiplier is not None:
self.embed_tokens.weight.data *= embedding_multiplier

prefix = "lm_head" if not prefix or name != "model" else f"{prefix}.lm_head"
prefix = "lm_head" if not prefix or name != "model" else f"{prefix}.{suffix}"

with no_fp8(weights):
self.lm_head = SpeculativeHead.load(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import torch
import torch.utils.checkpoint
from torch import nn
import math

from transformers.activations import ACT2FN
from text_generation_server.models.custom_modeling.vlm import (
Expand Down
4 changes: 2 additions & 2 deletions server/text_generation_server/models/vlm_causal_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


# copied from: https://github.com/huggingface/transformers/blob/02ed609285c2448b3b54c31e362f2c389fa952ab/src/transformers/models/idefics3/processing_idefics3.py#L44-L60
def get_image_prompt_string(
def _prompt_split_image(
*,
image_seq_len: int,
image_rows: int,
Expand Down Expand Up @@ -97,7 +97,7 @@ def image_text_replacement(processor, image_input, config, image_id: int) -> str
((config.vision_config.image_size // config.vision_config.patch_size) ** 2)
/ (config.scale_factor**2)
)
image_str = get_image_prompt_string(
image_str = _prompt_split_image(
image_seq_len=image_seq_len,
image_rows=n_rows,
image_cols=n_cols,
Expand Down

0 comments on commit 78004db

Please sign in to comment.