From 7b1011c1dcab62418aeb22e2d5286d68935012dd Mon Sep 17 00:00:00 2001 From: HyunJi Shin <74661937+shinhyunji36@users.noreply.github.com> Date: Sat, 20 Jul 2024 17:58:14 +0900 Subject: [PATCH 1/5] docs: ko: tasks/image_to_image.md --- docs/source/ko/_toctree.yml | 38 +++++-- docs/source/ko/tasks/image_to_image.md | 132 +++++++++++++++++++++++++ 2 files changed, 162 insertions(+), 8 deletions(-) create mode 100644 docs/source/ko/tasks/image_to_image.md diff --git a/docs/source/ko/_toctree.yml b/docs/source/ko/_toctree.yml index 6b4a3001f2d8..25db500c6405 100644 --- a/docs/source/ko/_toctree.yml +++ b/docs/source/ko/_toctree.yml @@ -27,6 +27,8 @@ title: 에이전트 - local: llm_tutorial title: 대규모 언어 모델로 생성하기 + - local: in_translation + title: (번역중)Chatting with Transformers title: 튜토리얼 - sections: - isExpanded: false @@ -71,8 +73,8 @@ title: 제로샷(zero-shot) 이미지 분류 - local: tasks/monocular_depth_estimation title: 단일 영상 기반 깊이 추정 - - local: in_translation - title: (번역중) Image-to-Image + - local: tasks/image_to_image + title: Image-to-Image - local: in_translation title: (번역중) Image Feature Extraction - local: in_translation @@ -131,21 +133,41 @@ title: (번역중) Notebooks with examples - local: community title: 커뮤니티 리소스 - - local: custom_tools - title: 사용자 정의 도구와 프롬프트 - local: troubleshooting title: 문제 해결 - local: in_translation - title: (번역중) Contribute new quantization method + title: (번역중) Interoperability with GGUF files title: (번역중) 개발자 가이드 +- sections: + - local: in_translation + title: (번역중) Getting started + - local: in_translation + title: (번역중) bitsandbytes + - local: in_translation + title: (번역중) GPTQ + - local: in_translation + title: (번역중) AWQ + - local: in_translation + title: (번역중) AQLM + - local: in_translation + title: (번역중) Quanto + - local: in_translation + title: (번역중) EETQ + - local: in_translation + title: (번역중) HQQ + - local: in_translation + title: (번역중) Optimum + - local: in_translation + title: (번역중) Contribute new quantization method + title: (번역중) 경량화 메소드 - sections: - local: performance title: 성능 및 확장성 - local: in_translation - title: (번역중) Quantization + title: (번역중) LLM inference optimization - sections: - local: in_translation - title: (번역중) Training on one GPU + title: (번역중) Methods and tools for efficient training on a single GPU - local: perf_train_gpu_many title: 다중 GPU에서 훈련 진행하기 - local: in_translation @@ -191,7 +213,7 @@ title: 테스트 - local: pr_checks title: Pull Request에 대한 검사 - title: (번역중) 기여하기 + title: 기여하기 - sections: - local: philosophy title: 이념과 목표 diff --git a/docs/source/ko/tasks/image_to_image.md b/docs/source/ko/tasks/image_to_image.md new file mode 100644 index 000000000000..6a11b515947c --- /dev/null +++ b/docs/source/ko/tasks/image_to_image.md @@ -0,0 +1,132 @@ +<!--Copyright 2023 The HuggingFace Team. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the +specific language governing permissions and limitations under the License. + +⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be +rendered properly in your Markdown viewer. + +--> + +# Image-to-Image Task Guide + +[[open-in-colab]] + +Image-to-Image task is the task where an application receives an image and outputs another image. This has various subtasks, including image enhancement (super resolution, low light enhancement, deraining and so on), image inpainting, and more. + +This guide will show you how to: +- Use an image-to-image pipeline for super resolution task, +- Run image-to-image models for same task without a pipeline. + +Note that as of the time this guide is released, `image-to-image` pipeline only supports super resolution task. + +Let's begin by installing the necessary libraries. + +```bash +pip install transformers +``` + +We can now initialize the pipeline with a [Swin2SR model](https://huggingface.co/caidas/swin2SR-lightweight-x2-64). We can then infer with the pipeline by calling it with an image. As of now, only [Swin2SR models](https://huggingface.co/models?sort=trending&search=swin2sr) are supported in this pipeline. + +```python +from transformers import pipeline + +device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') +pipe = pipeline(task="image-to-image", model="caidas/swin2SR-lightweight-x2-64", device=device) +``` + +Now, let's load an image. + +```python +from PIL import Image +import requests + +url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/cat.jpg" +image = Image.open(requests.get(url, stream=True).raw) + +print(image.size) +``` +```bash +# (532, 432) +``` +<div class="flex justify-center"> + <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/cat.jpg" alt="Photo of a cat"/> +</div> + +We can now do inference with the pipeline. We will get an upscaled version of the cat image. + +```python +upscaled = pipe(image) +print(upscaled.size) +``` +```bash +# (1072, 880) +``` + +If you wish to do inference yourself with no pipeline, you can use the `Swin2SRForImageSuperResolution` and `Swin2SRImageProcessor` classes of transformers. We will use the same model checkpoint for this. Let's initialize the model and the processor. + +```python +from transformers import Swin2SRForImageSuperResolution, Swin2SRImageProcessor + +model = Swin2SRForImageSuperResolution.from_pretrained("caidas/swin2SR-lightweight-x2-64").to(device) +processor = Swin2SRImageProcessor("caidas/swin2SR-lightweight-x2-64") +``` + +`pipeline` abstracts away the preprocessing and postprocessing steps that we have to do ourselves, so let's preprocess the image. We will pass the image to the processor and then move the pixel values to GPU. + +```python +pixel_values = processor(image, return_tensors="pt").pixel_values +print(pixel_values.shape) + +pixel_values = pixel_values.to(device) +``` + +We can now infer the image by passing pixel values to the model. + +```python +import torch + +with torch.no_grad(): + outputs = model(pixel_values) +``` +Output is an object of type `ImageSuperResolutionOutput` that looks like below 👇 + +``` +(loss=None, reconstruction=tensor([[[[0.8270, 0.8269, 0.8275, ..., 0.7463, 0.7446, 0.7453], + [0.8287, 0.8278, 0.8283, ..., 0.7451, 0.7448, 0.7457], + [0.8280, 0.8273, 0.8269, ..., 0.7447, 0.7446, 0.7452], + ..., + [0.5923, 0.5933, 0.5924, ..., 0.0697, 0.0695, 0.0706], + [0.5926, 0.5932, 0.5926, ..., 0.0673, 0.0687, 0.0705], + [0.5927, 0.5914, 0.5922, ..., 0.0664, 0.0694, 0.0718]]]], + device='cuda:0'), hidden_states=None, attentions=None) +``` +We need to get the `reconstruction` and post-process it for visualization. Let's see how it looks like. + +```python +outputs.reconstruction.data.shape +# torch.Size([1, 3, 880, 1072]) +``` + +We need to squeeze the output and get rid of axis 0, clip the values, then convert it to be numpy float. Then we will arrange axes to have the shape [1072, 880], and finally, bring the output back to range [0, 255]. + +```python +import numpy as np + +# squeeze, take to CPU and clip the values +output = outputs.reconstruction.data.squeeze().cpu().clamp_(0, 1).numpy() +# rearrange the axes +output = np.moveaxis(output, source=0, destination=-1) +# bring values back to pixel values range +output = (output * 255.0).round().astype(np.uint8) +Image.fromarray(output) +``` +<div class="flex justify-center"> + <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/cat_upscaled.png" alt="Upscaled photo of a cat"/> +</div> From a5cde295aafae00f3c38c96b273f9b3e8e34e27a Mon Sep 17 00:00:00 2001 From: HyunJi Shin <74661937+shinhyunji36@users.noreply.github.com> Date: Mon, 22 Jul 2024 19:27:17 +0900 Subject: [PATCH 2/5] feat: nmt draft --- docs/source/ko/tasks/image_to_image.md | 38 +++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/source/ko/tasks/image_to_image.md b/docs/source/ko/tasks/image_to_image.md index 6a11b515947c..48a3ac3579e6 100644 --- a/docs/source/ko/tasks/image_to_image.md +++ b/docs/source/ko/tasks/image_to_image.md @@ -14,25 +14,25 @@ rendered properly in your Markdown viewer. --> -# Image-to-Image Task Guide +# Image-to-Image Task Guide [[image-to-image-task-guide]] [[open-in-colab]] -Image-to-Image task is the task where an application receives an image and outputs another image. This has various subtasks, including image enhancement (super resolution, low light enhancement, deraining and so on), image inpainting, and more. +Image-to-Image 작업은 애플리케이션이 이미지를 입력받아 또 다른 이미지를 출력하는 작업입니다. 여기에는 이미지 향상(초고해상도, 저조도 향상, 빗물 제거 등), 이미지 복원 등 다양한 하위 작업이 포함됩니다. -This guide will show you how to: -- Use an image-to-image pipeline for super resolution task, -- Run image-to-image models for same task without a pipeline. +이 가이드에서는 다음을 수행하는 방법을 보여줍니다. +- 초고해상도 작업을 위한 image-to-image 파이프라인 사용, +- 파이프라인 없이 동일한 작업을 위한 image-to-image 모델 실행 -Note that as of the time this guide is released, `image-to-image` pipeline only supports super resolution task. +이 가이드가 발표된 시점에서는, `image-to-image` 파이프라인은 초고해상도 작업만 지원합니다. -Let's begin by installing the necessary libraries. +필요한 라이브러리를 설치하는 것부터 시작하겠습니다. ```bash pip install transformers ``` -We can now initialize the pipeline with a [Swin2SR model](https://huggingface.co/caidas/swin2SR-lightweight-x2-64). We can then infer with the pipeline by calling it with an image. As of now, only [Swin2SR models](https://huggingface.co/models?sort=trending&search=swin2sr) are supported in this pipeline. +이제 [Swin2SR 모델](https://huggingface.co/caidas/swin2SR-lightweight-x2-64)을 사용하여 파이프라인을 초기화할 수 있습니다. 그런 다음 이미지와 함께 호출하여 파이프라인으로 추론할 수 있습니다. 현재 이 파이프라인에서는 [Swin2SR 모델](https://huggingface.co/caidas/swin2SR-lightweight-x2-64)만 지원됩니다. ```python from transformers import pipeline @@ -41,7 +41,7 @@ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') pipe = pipeline(task="image-to-image", model="caidas/swin2SR-lightweight-x2-64", device=device) ``` -Now, let's load an image. +이제 이미지를 불러와 봅시다. ```python from PIL import Image @@ -59,7 +59,7 @@ print(image.size) <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/cat.jpg" alt="Photo of a cat"/> </div> -We can now do inference with the pipeline. We will get an upscaled version of the cat image. +이제 파이프라인으로 추론을 수행할 수 있습니다. 고양이 이미지의 업스케일된 버전을 얻을 수 있습니다. ```python upscaled = pipe(image) @@ -69,7 +69,7 @@ print(upscaled.size) # (1072, 880) ``` -If you wish to do inference yourself with no pipeline, you can use the `Swin2SRForImageSuperResolution` and `Swin2SRImageProcessor` classes of transformers. We will use the same model checkpoint for this. Let's initialize the model and the processor. +파이프라인 없이 직접 추론을 수행하려면 Transformers의 `Swin2SRForImageSuperResolution` 및 `Swin2SRImageProcessor` 클래스를 사용할 수 있습니다. 이를 위해 동일한 모델 체크포인트를 사용합니다. 모델과 프로세서를 초기화해 보겠습니다. ```python from transformers import Swin2SRForImageSuperResolution, Swin2SRImageProcessor @@ -78,7 +78,7 @@ model = Swin2SRForImageSuperResolution.from_pretrained("caidas/swin2SR-lightweig processor = Swin2SRImageProcessor("caidas/swin2SR-lightweight-x2-64") ``` -`pipeline` abstracts away the preprocessing and postprocessing steps that we have to do ourselves, so let's preprocess the image. We will pass the image to the processor and then move the pixel values to GPU. +pipeline은 우리가 직접 해야 하는 전처리와 후처리 단계를 추상화해 주므로, 이제 이미지를 전처리해 봅시다. 이미지를 프로세서에 전달한 다음, 픽셀 값을 GPU로 이동시킬 것입니다. ```python pixel_values = processor(image, return_tensors="pt").pixel_values @@ -87,7 +87,7 @@ print(pixel_values.shape) pixel_values = pixel_values.to(device) ``` -We can now infer the image by passing pixel values to the model. +이제 픽셀 값을 모델에 전달하여 이미지를 추론할 수 있습니다. ```python import torch @@ -95,7 +95,7 @@ import torch with torch.no_grad(): outputs = model(pixel_values) ``` -Output is an object of type `ImageSuperResolutionOutput` that looks like below 👇 +출력은 아래와 같은 `ImageSuperResolutionOutput` 유형의 객체입니다 👇 ``` (loss=None, reconstruction=tensor([[[[0.8270, 0.8269, 0.8275, ..., 0.7463, 0.7446, 0.7453], @@ -107,23 +107,23 @@ Output is an object of type `ImageSuperResolutionOutput` that looks like below [0.5927, 0.5914, 0.5922, ..., 0.0664, 0.0694, 0.0718]]]], device='cuda:0'), hidden_states=None, attentions=None) ``` -We need to get the `reconstruction` and post-process it for visualization. Let's see how it looks like. +`reconstruction`를 가져와 시각화를 위해 후처리해야 합니다. 어떻게 생겼는지 살펴봅시다. ```python outputs.reconstruction.data.shape # torch.Size([1, 3, 880, 1072]) ``` -We need to squeeze the output and get rid of axis 0, clip the values, then convert it to be numpy float. Then we will arrange axes to have the shape [1072, 880], and finally, bring the output back to range [0, 255]. +출력 텐서의 크기를 줄이고 0번째 차원을 제거한 다음, 값을 자르고 numpy float으로 변환해야합니다. 그런 다음 [1072, 880] 모양을 갖도록 축을 정렬하고 마지막으로 출력을 [0, 255] 범위로 되돌립니다. ```python import numpy as np -# squeeze, take to CPU and clip the values +# 크기를 줄이고, CPU로 이동하고, 값을 자릅니다. output = outputs.reconstruction.data.squeeze().cpu().clamp_(0, 1).numpy() -# rearrange the axes +# 차원을 재정렬합니다. output = np.moveaxis(output, source=0, destination=-1) -# bring values back to pixel values range +# 값을 픽셀값 범위로 되돌립니다. output = (output * 255.0).round().astype(np.uint8) Image.fromarray(output) ``` From 6fe872b31dbb51b1ebb1fa330074e73f16016803 Mon Sep 17 00:00:00 2001 From: HyunJi Shin <74661937+shinhyunji36@users.noreply.github.com> Date: Tue, 30 Jul 2024 22:35:32 +0900 Subject: [PATCH 3/5] fix: manual edits --- docs/source/ko/tasks/image_to_image.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/source/ko/tasks/image_to_image.md b/docs/source/ko/tasks/image_to_image.md index 48a3ac3579e6..53711a89d08e 100644 --- a/docs/source/ko/tasks/image_to_image.md +++ b/docs/source/ko/tasks/image_to_image.md @@ -14,11 +14,11 @@ rendered properly in your Markdown viewer. --> -# Image-to-Image Task Guide [[image-to-image-task-guide]] +# Image-to-Image 작업 가이드 [[image-to-image-task-guide]] [[open-in-colab]] -Image-to-Image 작업은 애플리케이션이 이미지를 입력받아 또 다른 이미지를 출력하는 작업입니다. 여기에는 이미지 향상(초고해상도, 저조도 향상, 빗물 제거 등), 이미지 복원 등 다양한 하위 작업이 포함됩니다. +Image-to-Image 작업은 애플리케이션이 이미지를 입력받아 또 다른 이미지를 출력하는 작업입니다. 여기에는 이미지 향상(초고해상도, 저조도 향상, 빗줄기 제거 등), 이미지 복원 등 다양한 하위 작업이 포함됩니다. 이 가이드에서는 다음을 수행하는 방법을 보여줍니다. - 초고해상도 작업을 위한 image-to-image 파이프라인 사용, @@ -32,7 +32,7 @@ Image-to-Image 작업은 애플리케이션이 이미지를 입력받아 또 다 pip install transformers ``` -이제 [Swin2SR 모델](https://huggingface.co/caidas/swin2SR-lightweight-x2-64)을 사용하여 파이프라인을 초기화할 수 있습니다. 그런 다음 이미지와 함께 호출하여 파이프라인으로 추론할 수 있습니다. 현재 이 파이프라인에서는 [Swin2SR 모델](https://huggingface.co/caidas/swin2SR-lightweight-x2-64)만 지원됩니다. +이제 [Swin2SR 모델](https://huggingface.co/caidas/swin2SR-lightweight-x2-64)을 사용하여 파이프라인을 초기화할 수 있습니다. 그런 다음 이미지와 함께 호출하여 파이프라인으로 추론할 수 있습니다. 현재 이 파이프라인에서는 [Swin2SR 모델](https://huggingface.co/caidas/swin2SR-lightweight-x2-64)만 지원됩니다. ```python from transformers import pipeline @@ -78,7 +78,7 @@ model = Swin2SRForImageSuperResolution.from_pretrained("caidas/swin2SR-lightweig processor = Swin2SRImageProcessor("caidas/swin2SR-lightweight-x2-64") ``` -pipeline은 우리가 직접 해야 하는 전처리와 후처리 단계를 추상화해 주므로, 이제 이미지를 전처리해 봅시다. 이미지를 프로세서에 전달한 다음, 픽셀 값을 GPU로 이동시킬 것입니다. +파이프라인은 우리가 직접 해야 하는 전처리와 후처리 단계를 추상화해 주므로, 이제 이미지를 전처리해 봅시다. 이미지를 프로세서에 전달한 다음, 픽셀 값을 GPU로 이동시킬 것입니다. ```python pixel_values = processor(image, return_tensors="pt").pixel_values @@ -114,14 +114,14 @@ outputs.reconstruction.data.shape # torch.Size([1, 3, 880, 1072]) ``` -출력 텐서의 크기를 줄이고 0번째 차원을 제거한 다음, 값을 자르고 numpy float으로 변환해야합니다. 그런 다음 [1072, 880] 모양을 갖도록 축을 정렬하고 마지막으로 출력을 [0, 255] 범위로 되돌립니다. +출력 텐서의 차원을 축소하고 0번째 축을 제거한 다음, 값을 클리핑하고 NumPy 부동소수점 배열로 변환해야합니다. 그런 다음 [1072, 880] 모양을 갖도록 축을 재정렬하고 마지막으로 출력을 0과 255 사이의 값을 갖도록 되돌립니다. ```python import numpy as np -# 크기를 줄이고, CPU로 이동하고, 값을 자릅니다. +# 크기를 줄이고, CPU로 이동하고, 값을 클리핑합니다. output = outputs.reconstruction.data.squeeze().cpu().clamp_(0, 1).numpy() -# 차원을 재정렬합니다. +# 축을 재정렬합니다. output = np.moveaxis(output, source=0, destination=-1) # 값을 픽셀값 범위로 되돌립니다. output = (output * 255.0).round().astype(np.uint8) From e256e4eec764d5cd0c63ab8aea26c22cd3bd4646 Mon Sep 17 00:00:00 2001 From: HyunJi Shin <74661937+shinhyunji36@users.noreply.github.com> Date: Tue, 6 Aug 2024 23:40:16 +0900 Subject: [PATCH 4/5] fix: resolve suggestions Co-authored-by: Jihun Lim <31366038+heuristicwave@users.noreply.github.com> Co-authored-by: Jiwook Han <33192762+mreraser@users.noreply.github.com> --- docs/source/ko/tasks/image_to_image.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/source/ko/tasks/image_to_image.md b/docs/source/ko/tasks/image_to_image.md index 53711a89d08e..05bbc393a0ab 100644 --- a/docs/source/ko/tasks/image_to_image.md +++ b/docs/source/ko/tasks/image_to_image.md @@ -24,7 +24,7 @@ Image-to-Image 작업은 애플리케이션이 이미지를 입력받아 또 다 - 초고해상도 작업을 위한 image-to-image 파이프라인 사용, - 파이프라인 없이 동일한 작업을 위한 image-to-image 모델 실행 -이 가이드가 발표된 시점에서는, `image-to-image` 파이프라인은 초고해상도 작업만 지원합니다. +이 가이드가 발표된 시점에서는, `image-to-image` 파이프라인은 초고해상도 작업만 지원한다는 점을 유의하세요. 필요한 라이브러리를 설치하는 것부터 시작하겠습니다. @@ -78,7 +78,7 @@ model = Swin2SRForImageSuperResolution.from_pretrained("caidas/swin2SR-lightweig processor = Swin2SRImageProcessor("caidas/swin2SR-lightweight-x2-64") ``` -파이프라인은 우리가 직접 해야 하는 전처리와 후처리 단계를 추상화해 주므로, 이제 이미지를 전처리해 봅시다. 이미지를 프로세서에 전달한 다음, 픽셀 값을 GPU로 이동시킬 것입니다. +`pipeline` 우리가 직접 수행해야 하는 전처리와 후처리 단계를 추상화하므로, 이미지를 전처리해 보겠습니다. 이미지를 프로세서에 전달한 다음 픽셀 값을 GPU로 이동시키겠습니다. ```python pixel_values = processor(image, return_tensors="pt").pixel_values @@ -114,16 +114,16 @@ outputs.reconstruction.data.shape # torch.Size([1, 3, 880, 1072]) ``` -출력 텐서의 차원을 축소하고 0번째 축을 제거한 다음, 값을 클리핑하고 NumPy 부동소수점 배열로 변환해야합니다. 그런 다음 [1072, 880] 모양을 갖도록 축을 재정렬하고 마지막으로 출력을 0과 255 사이의 값을 갖도록 되돌립니다. +출력 텐서의 차원을 축소하고 0번째 축을 제거한 다음, 값을 클리핑하고 NumPy 부동소수점 배열로 변환해야 합니다. 그런 다음 [1072, 880] 모양을 갖도록 축을 재정렬하고 마지막으로 출력을 0과 255 사이의 값을 갖도록 되돌립니다. ```python import numpy as np -# 크기를 줄이고, CPU로 이동하고, 값을 클리핑합니다. +# 크기를 줄이고, CPU로 이동하고, 값을 클리핑 output = outputs.reconstruction.data.squeeze().cpu().clamp_(0, 1).numpy() -# 축을 재정렬합니다. +# 축을 재정렬 output = np.moveaxis(output, source=0, destination=-1) -# 값을 픽셀값 범위로 되돌립니다. +# 값을 픽셀값 범위로 되돌리기 output = (output * 255.0).round().astype(np.uint8) Image.fromarray(output) ``` From 750c7b8980559c0805aae1aabd0cc9334d158697 Mon Sep 17 00:00:00 2001 From: HyunJi Shin <74661937+shinhyunji36@users.noreply.github.com> Date: Tue, 6 Aug 2024 23:55:48 +0900 Subject: [PATCH 5/5] fix: handle remaining suggestions Co-authored-by: Jiwook Han <33192762+mreraser@users.noreply.github.com> --- docs/source/ko/tasks/image_to_image.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/ko/tasks/image_to_image.md b/docs/source/ko/tasks/image_to_image.md index 05bbc393a0ab..f76122f78445 100644 --- a/docs/source/ko/tasks/image_to_image.md +++ b/docs/source/ko/tasks/image_to_image.md @@ -78,7 +78,7 @@ model = Swin2SRForImageSuperResolution.from_pretrained("caidas/swin2SR-lightweig processor = Swin2SRImageProcessor("caidas/swin2SR-lightweight-x2-64") ``` -`pipeline` 우리가 직접 수행해야 하는 전처리와 후처리 단계를 추상화하므로, 이미지를 전처리해 보겠습니다. 이미지를 프로세서에 전달한 다음 픽셀 값을 GPU로 이동시키겠습니다. +`pipeline` 우리가 직접 수행해야 하는 전처리와 후처리 단계를 추상화하므로, 이미지를 전처리해 보겠습니다. 이미지를 프로세서에 전달한 다음 픽셀값을 GPU로 이동시키겠습니다. ```python pixel_values = processor(image, return_tensors="pt").pixel_values @@ -87,7 +87,7 @@ print(pixel_values.shape) pixel_values = pixel_values.to(device) ``` -이제 픽셀 값을 모델에 전달하여 이미지를 추론할 수 있습니다. +이제 픽셀값을 모델에 전달하여 이미지를 추론할 수 있습니다. ```python import torch