Unverified Commit 1bde94d4 authored by Qi Wang's avatar Qi Wang Committed by GitHub
Browse files

chore: remove costly logs in EPD (#6696)

parent 05f10e93
......@@ -49,8 +49,6 @@ async def fetch_embeddings_from_encoder(
if not image_urls:
raise ValueError("image_urls must not be empty")
logger.info(f"fetch_embeddings_from_encoder: image_urls={image_urls}")
if encoder_cache:
# Cache path: extract embeddings to CPU tensors
return await _fetch_embeddings_with_cache(
......@@ -148,26 +146,18 @@ async def _fetch_embeddings_with_cache(
url_hash = MultimodalHasher.hash_bytes(url.encode())
cached = cache.get(url_hash)
if cached is not None:
logger.info(f"fetch_embeddings_with_cache: cache hit for URL: {url}")
embeddings_with_index.append((i, cached.tensor))
else:
logger.info(f"fetch_embeddings_with_cache: cache miss for URL: {url}")
uncached_urls.append(url)
uncached_indices.append(i)
uncached_hashes.append(url_hash)
# If all cached, return immediately
if not uncached_urls:
logger.info(f"fetch_embeddings_with_cache: all {len(image_urls)} URLs cached")
embeddings_with_index.sort(key=lambda x: x[0])
tensors = [t for _, t in embeddings_with_index]
return tensors
# Encode uncached URLs
logger.info(
f"fetch_embeddings_with_cache: encoding {len(uncached_urls)} uncached URLs"
)
# Create modified request with only uncached URLs
modified_request = _create_request_with_urls(request, uncached_urls)
......@@ -191,9 +181,6 @@ async def _fetch_embeddings_with_cache(
# Cache new tensors (reuse hashes computed during cache lookup)
for url, url_hash, tensor in zip(uncached_urls, uncached_hashes, new_tensors):
cache.set(url_hash, CachedEmbedding(tensor=tensor))
logger.info(
f"fetch_embeddings_with_cache: cached embedding for URL: {url}, shape: {tensor.shape}"
)
# Add new tensors to our list with their original indices
for idx, tensor in zip(uncached_indices, new_tensors):
......
......@@ -47,7 +47,6 @@ class AggregatedHandler(HandlerBase):
messages
)
if image_urls:
logging.info(f"AggregatedHandler: image_urls={image_urls}")
result = await fetch_embeddings_from_encoder(
image_urls,
request,
......
......@@ -158,7 +158,6 @@ class PrefillHandler(HandlerBase):
# Handle image URLs (full E-PD flow with MultimodalEncoder)
elif image_urls:
if self.encode_client:
logging.info(f"PrefillHandler: image_urls={image_urls}")
result = await fetch_embeddings_from_encoder(
image_urls,
request,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment