vlm: enforce pybase64 for image and str encode/decode (#10700)
This commit is contained in:
@@ -31,7 +31,10 @@ from typing import Any, AsyncGenerator, Dict, List, Optional, Tuple, Union
|
||||
|
||||
import aiohttp
|
||||
import numpy as np
|
||||
import pybase64
|
||||
import requests
|
||||
from datasets import load_dataset
|
||||
from PIL import Image
|
||||
from tqdm.asyncio import tqdm
|
||||
from transformers import (
|
||||
AutoProcessor,
|
||||
@@ -1020,14 +1023,6 @@ def sample_mmmu_requests(
|
||||
Returns:
|
||||
List of tuples (prompt, prompt_token_len, output_token_len).
|
||||
"""
|
||||
try:
|
||||
import io
|
||||
|
||||
import pybase64
|
||||
from datasets import load_dataset
|
||||
except ImportError:
|
||||
raise ImportError("Please install datasets: pip install datasets")
|
||||
|
||||
print("Loading MMMU dataset from HuggingFace...")
|
||||
|
||||
try:
|
||||
@@ -1396,13 +1391,6 @@ def sample_image_requests(
|
||||
- Text lengths follow the 'random' dataset sampling rule. ``prompt_len``
|
||||
only counts text tokens and excludes image data.
|
||||
"""
|
||||
try:
|
||||
import pybase64
|
||||
from PIL import Image
|
||||
except ImportError as e:
|
||||
raise ImportError(
|
||||
"Please install Pillow to generate random images: pip install pillow"
|
||||
) from e
|
||||
|
||||
# Parse resolution (supports presets and 'heightxwidth')
|
||||
width, height = parse_image_resolution(image_resolution)
|
||||
|
||||
Reference in New Issue
Block a user