mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
@@ -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**
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user