Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
vladmandic
2026-02-11 10:02:41 +01:00
parent 967974ade7
commit 8561da6f8c
2 changed files with 4 additions and 4 deletions
+1
View File
@@ -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**
+3 -4
View File
@@ -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