From 8561da6f8cc9f6aafdcd07763ec7c3048c5abbe5 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Wed, 11 Feb 2026 10:02:41 +0100 Subject: [PATCH] cleanup Signed-off-by: vladmandic --- CHANGELOG.md | 1 + modules/caption/joytag.py | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5341d317b..dacd83f93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ - refactor: switch to `pyproject.toml` for tool configs - refactor: reorganize `cli` scripts - refactor: move tests to dedicated `/test/` + - refactor: captioning part-2, thanks @CalamitousFelicitousness - update `lint` rules, thanks @awsr - update `requirements` - **Fixes** diff --git a/modules/caption/joytag.py b/modules/caption/joytag.py index 97a05b8b5..f2f5d741e 100644 --- a/modules/caption/joytag.py +++ b/modules/caption/joytag.py @@ -14,11 +14,10 @@ import torch.nn as nn import torch.nn.functional as F from transformers.activations import QuickGELUActivation import torchvision -import torchvision.transforms.functional as TVF import einops from einops.layers.torch import Rearrange import huggingface_hub -from modules import shared, devices, sd_models +from modules import shared, devices, sd_models, images_sharpfin model = None @@ -1035,8 +1034,8 @@ def prepare_image(image: Image.Image, target_size: int) -> torch.Tensor: padded_image.paste(image, (pad_left, pad_top)) if max_dim != target_size: padded_image = padded_image.resize((target_size, target_size), Image.Resampling.LANCZOS) - image_tensor = TVF.pil_to_tensor(padded_image) / 255.0 - image_tensor = TVF.normalize(image_tensor, mean=[0.48145466, 0.4578275, 0.40821073], std=[0.26862954, 0.26130258, 0.27577711]) + image_tensor = images_sharpfin.to_tensor(padded_image) + image_tensor = images_sharpfin.normalize(image_tensor, mean=[0.48145466, 0.4578275, 0.40821073], std=[0.26862954, 0.26130258, 0.27577711]) return image_tensor