Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/source/ko/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
title: πŸ€— Tokenizers λΌμ΄λΈŒλŸ¬λ¦¬μ—μ„œ ν† ν¬λ‚˜μ΄μ € μ‚¬μš©ν•˜κΈ°
- local: image_processors
title: 이미지 ν”„λ‘œμ„Έμ„œ
- local: in_translation
title: (λ²ˆμ—­μ€‘) Video processors
- local: video_processors
title: λΉ„λ””μ˜€ ν”„λ‘œμ„Έμ„œ
- local: in_translation
title: (λ²ˆμ—­μ€‘) Backbones
- local: in_translation
Expand Down
48 changes: 48 additions & 0 deletions docs/source/ko/video_processors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--Copyright 2025 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.

-->

# λΉ„λ””μ˜€ ν”„λ‘œμ„Έμ„œ[[video-processor]]

**λΉ„λ””μ˜€ ν”„λ‘œμ„Έμ„œ(Video Processor)**λŠ” λΉ„λ””μ˜€ λͺ¨λΈμ˜ μž…λ ₯으둜 μ‚¬μš©λ  νŠΉμ„± 값듀을 μ€€λΉ„ν•˜κ³ , λͺ¨λΈ 좜λ ₯의 ν›„μ²˜λ¦¬λ₯Ό μ§€μ›ν•˜λŠ” μœ ν‹Έλ¦¬ν‹°μž…λ‹ˆλ‹€. 크기 μ‘°μ •, μ •κ·œν™”, PyTorch ν…μ„œ λ³€ν™˜ λ“±μ˜ κΈ°λŠ₯을 μ œκ³΅ν•©λ‹ˆλ‹€.

λΉ„λ””μ˜€ ν”„λ‘œμ„Έμ„œλŠ” 이미지 ν”„λ‘œμ„Έμ„œμ˜ κΈ°λŠ₯을 ν™•μž₯ν•˜μ—¬, λͺ¨λΈμ΄ μ˜μƒμ„ μ²˜λ¦¬ν•  λ•Œ μ΄λ―Έμ§€μ™€λŠ” κ΅¬λ³„λ˜λŠ” λ³„λ„μ˜ 인수λ₯Ό μ‚¬μš©ν•  수 μžˆλ„λ‘ ν•©λ‹ˆλ‹€. λ˜ν•œ 원본 λΉ„λ””μ˜€ 데이터와 λͺ¨λΈ 사이λ₯Ό μ—°κ²°ν•˜λŠ” 역할을 ν•˜λ©°, μž…λ ₯ νŠΉμ„± 값듀이 VLM에 μ΅œμ ν™”λ˜λ„λ‘ 보μž₯ν•©λ‹ˆλ‹€.

[`~BaseVideoProcessor.from_pretrained`]λ₯Ό μ‚¬μš©ν•˜λ©΄ Hugging Face [Hub](https://hf.co) λ˜λŠ” 둜컬 디렉터리에 μžˆλŠ” λΉ„λ””μ˜€ λͺ¨λΈλ‘œλΆ€ν„° λΉ„λ””μ˜€ ν”„λ‘œμ„Έμ„œ μ„€μ •(이미지 크기, μ •κ·œν™” 및 λ¦¬μŠ€μΌ€μΌ μ—¬λΆ€ λ“±)을 뢈러올 수 μžˆμŠ΅λ‹ˆλ‹€. 각 사전 ν•™μŠ΅λœ λͺ¨λΈμ˜ 섀정은 [video_preprocessor_config.json] νŒŒμΌμ— μ €μž₯λ˜μ–΄μ•Ό ν•˜μ§€λ§Œ, 일뢀 였래된 λͺ¨λΈμ˜ 경우 [preprocessor_config.json](https://huggingface.co/llava-hf/llava-onevision-qwen2-0.5b-ov-hf/blob/main/preprocessor_config.json) νŒŒμΌμ— μ €μž₯λ˜μ–΄ μžˆμ„ μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€. ν›„μžμ˜ κ²½μš°λŠ” ꢌμž₯λ˜μ§€ μ•ŠμœΌλ©° ν–₯ν›„ 제거될 μ˜ˆμ •μž…λ‹ˆλ‹€.

### μ‚¬μš© μ˜ˆμ‹œ[[usage-example]]

λ‹€μŒμ€ [`llava-hf/llava-onevision-qwen2-0.5b-ov-hf`](https://huggingface.co/llava-hf/llava-onevision-qwen2-0.5b-ov-hf) λͺ¨λΈκ³Ό ν•¨κ»˜ λΉ„λ””μ˜€ ν”„λ‘œμ„Έμ„œλ₯Ό λ‘œλ“œν•˜λŠ” μ˜ˆμ‹œμž…λ‹ˆλ‹€.

```python
from transformers import AutoVideoProcessor

processor = AutoVideoProcessor.from_pretrained("llava-hf/llava-onevision-qwen2-0.5b-ov-hf")
```

ν˜„μž¬ λΉ„λ””μ˜€μ— κΈ°λ³Έ 이미지 ν”„λ‘œμ„Έμ„œλ₯Ό μ‚¬μš©ν•  경우, λΉ„λ””μ˜€ λ°μ΄ν„°μ˜ 각 ν”„λ ˆμž„μ΄ κ°œλ³„ μ΄λ―Έμ§€λ‘œ μ²˜λ¦¬λ˜μ–΄ λ³€ν™˜μ΄ μ μš©λ©λ‹ˆλ‹€. 이 방식도 잘 λ™μž‘ν•˜κΈ΄ ν•˜μ§€λ§Œ 효율이 μ’‹μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. 이 λŒ€μ‹  `AutoVideoProcessor`λ₯Ό μ‚¬μš©ν•˜λ©΄ [torchvision](https://pytorch.org/vision/stable/index.html) 라이브러리λ₯Ό ν™œμš©ν•œ **fast video processors**의 이점을 λˆ„λ¦΄ 수 μžˆμŠ΅λ‹ˆλ‹€. Fast processorsλŠ” 각 λΉ„λ””μ˜€λ‚˜ ν”„λ ˆμž„μ„ ν•˜λ‚˜μ”© μ²˜λ¦¬ν•˜μ§€ μ•Šκ³ , 전체 λΉ„λ””μ˜€ 배치λ₯Ό ν•œ λ²ˆμ— μ²˜λ¦¬ν•©λ‹ˆλ‹€. μ΄λŠ” GPU 가속을 λ„μž…ν•˜λ©°, 특히 높은 μ²˜λ¦¬λŸ‰μ΄ ν•„μš”ν•œ μž‘μ—…μ—μ„œ 처리 속도λ₯Ό 크게 ν–₯μƒμ‹œν‚΅λ‹ˆλ‹€.

Fast video processorsλŠ” λͺ¨λ“  λͺ¨λΈμ—μ„œ μ‚¬μš©ν•  수 있으며 `AutoVideoProcessor`κ°€ μ΄ˆκΈ°ν™”λ  λ•Œ 같이 λ‘œλ“œλ©λ‹ˆλ‹€. Fast video processorsλ₯Ό μ‚¬μš©ν•  λ•ŒλŠ” `device` 인수λ₯Ό μ„€μ •ν•˜μ—¬ μ–΄λ–€ μž₯μΉ˜μ—μ„œ 처리λ₯Ό μˆ˜ν–‰ν• μ§€ μ§€μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€. ν…μ„œλ₯Ό μž…λ ₯으둜 ν•˜λŠ” 경우, 기본적으둜 μž…λ ₯κ³Ό λ™μΌν•œ μž₯μΉ˜μ—μ„œ 처리되며, κ·Έλ ‡μ§€ μ•Šμ€ 경우 CPUμ—μ„œ μ²˜λ¦¬λ©λ‹ˆλ‹€. μž₯치둜 'cuda'λ₯Ό μ‚¬μš©ν•˜λŠ” 경우, 좔가적인 속도 ν–₯상을 μœ„ν•΄ ν”„λ‘œμ„Έμ„œλ₯Ό μ»΄νŒŒμΌν•˜μ—¬ μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

```python
import torch
from transformers.video_utils import load_video
from transformers import AutoVideoProcessor

video = load_video("video.mp4")
processor = AutoVideoProcessor.from_pretrained("llava-hf/llava-onevision-qwen2-0.5b-ov-hf", device="cuda")
processor = torch.compile(processor)
processed_video = processor(video, return_tensors="pt")
```