Clean up deprecation warnings (#19654)
* Clean up deprecation warnings Notes: Changed some strings in tests to raw strings, which will change the literal content of the strings as they are fed into whatever machine handles them. Test cases for past in the past/past_key_values switch changed/removed due to warning of impending removal * Add PILImageResampling abstraction for PIL.Image.Resampling
This commit is contained in:
@@ -23,6 +23,7 @@ import torch
|
||||
from PIL import Image
|
||||
from torch import nn
|
||||
|
||||
from transformers.image_utils import PILImageResampling
|
||||
from utils import img_tensorize
|
||||
|
||||
|
||||
@@ -59,7 +60,7 @@ class ResizeShortestEdge:
|
||||
|
||||
if img.dtype == np.uint8:
|
||||
pil_image = Image.fromarray(img)
|
||||
pil_image = pil_image.resize((neww, newh), Image.BILINEAR)
|
||||
pil_image = pil_image.resize((neww, newh), PILImageResampling.BILINEAR)
|
||||
img = np.asarray(pil_image)
|
||||
else:
|
||||
img = img.permute(2, 0, 1).unsqueeze(0) # 3, 0, 1) # hw(c) -> nchw
|
||||
|
||||
@@ -23,6 +23,7 @@ import torch
|
||||
from PIL import Image
|
||||
from torch import nn
|
||||
|
||||
from transformers.image_utils import PILImageResampling
|
||||
from utils import img_tensorize
|
||||
|
||||
|
||||
@@ -59,7 +60,7 @@ class ResizeShortestEdge:
|
||||
|
||||
if img.dtype == np.uint8:
|
||||
pil_image = Image.fromarray(img)
|
||||
pil_image = pil_image.resize((neww, newh), Image.BILINEAR)
|
||||
pil_image = pil_image.resize((neww, newh), PILImageResampling.BILINEAR)
|
||||
img = np.asarray(pil_image)
|
||||
else:
|
||||
img = img.permute(2, 0, 1).unsqueeze(0) # 3, 0, 1) # hw(c) -> nchw
|
||||
|
||||
Reference in New Issue
Block a user