-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[https://nvbugs/5550722][fix] Fix image load #8093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/1.1
Are you sure you want to change the base?
Conversation
Signed-off-by: yechank <161688079+yechank-nvidia@users.noreply.github.com>
/bot run |
📝 WalkthroughWalkthroughReplaces hard-coded remote media URLs with local filesystem paths in a single test file by introducing pathlib.Path and a test_data_root. All multimodal test inputs now reference local files via str(test_data_root / ""). No public interfaces are changed. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/unittest/_torch/modeling/test_modeling_qwen2_5vl.py (1)
1-1
: Add required copyright header.Per coding guidelines, all Python source files must include the NVIDIA Apache-2.0 copyright header with the current year (2025) at the top of the file.
Add the copyright header before the imports:
+# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# 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. + import os
🧹 Nitpick comments (1)
tests/unittest/_torch/modeling/test_modeling_qwen2_5vl.py (1)
111-112
: Simplify using Path's division operator.Since you're using
pathlib.Path
, leverage its division operator instead of mixing withos.path.join
for cleaner, more idiomatic code.Apply this diff:
- test_data_root = Path( - os.path.join(llm_models_root(), "multimodals", "test_data")) + test_data_root = Path(llm_models_root()) / "multimodals" / "test_data"
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/unittest/_torch/modeling/test_modeling_qwen2_5vl.py
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Use only spaces, no tabs; indent with 4 spaces.
Files:
tests/unittest/_torch/modeling/test_modeling_qwen2_5vl.py
**/*.py
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.py
: Python code must target Python 3.8+.
Indent Python code with 4 spaces; do not use tabs.
Maintain module namespace when importing; prefer 'from package.subpackage import foo' then 'foo.SomeClass()' instead of importing the class directly.
Python filenames should be snake_case (e.g., some_file.py).
Python classes use PascalCase names.
Functions and methods use snake_case names.
Local variables use snake_case; prefix 'k' for variables that start with a number (e.g., k_99th_percentile).
Global variables use upper SNAKE_CASE prefixed with 'G' (e.g., G_MY_GLOBAL).
Constants use upper SNAKE_CASE (e.g., MY_CONSTANT).
Avoid shadowing variables from an outer scope.
Initialize all externally visible members of a class in the constructor.
Prefer docstrings for interfaces that may be used outside a file; comments for in-function or file-local interfaces.
Use Google-style docstrings for classes and functions (Sphinx-parsable).
Document attributes and variables inline so they render under the class/function docstring.
Avoid reflection when a simpler, explicit approach suffices (e.g., avoid dict(**locals()) patterns).
In try/except, catch the most specific exceptions possible.
For duck-typing try/except, keep the try body minimal and use else for the main logic.
Files:
tests/unittest/_torch/modeling/test_modeling_qwen2_5vl.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Prepend the NVIDIA Apache-2.0 copyright header with current year to the top of all source files (e.g., .cpp, .h, .cu, .py).
Files:
tests/unittest/_torch/modeling/test_modeling_qwen2_5vl.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
🔇 Additional comments (1)
tests/unittest/_torch/modeling/test_modeling_qwen2_5vl.py (1)
5-5
: LGTM!The
Path
import is appropriate for constructing filesystem paths in a cross-platform manner.
if modality == "image": | ||
return ["Describe the natural environment in the image."], \ | ||
["https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/seashore.png"] | ||
[str(test_data_root / "seashore.png")] | ||
elif modality == "multiple_image": | ||
return ["Describe the difference between the two images."], \ | ||
["https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/inpaint.png", | ||
"https://huggingface.co/datasets/Sayali9141/traffic_signal_images/resolve/main/61.jpg"] | ||
[str(test_data_root / "inpaint.png"), | ||
str(test_data_root / "61.jpg")] | ||
elif modality == "video": | ||
return ["Tell me what you see in the video briefly."], \ | ||
["https://huggingface.co/datasets/Efficient-Large-Model/VILA-inference-demos/resolve/main/OAI-sora-tokyo-walk.mp4"] | ||
[str(test_data_root / "OAI-sora-tokyo-walk.mp4")] | ||
elif modality == "mixture_text_image": | ||
return ["Describe the scene in the image briefly.", | ||
"Who invented the internet?"], \ | ||
["https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/inpaint.png", | ||
[str(test_data_root / "inpaint.png"), | ||
""] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify test data files exist at the specified paths.
The local filesystem paths look correctly constructed using Path
. Ensure that the test data files (seashore.png
, inpaint.png
, 61.jpg
, OAI-sora-tokyo-walk.mp4
) exist in the <llm_models_root>/multimodals/test_data/
directory before running these tests.
Run this script to verify the test data files exist:
🏁 Script executed:
#!/bin/bash
# Description: Check if test data files exist at expected locations
# Determine LLM_MODELS_ROOT (respecting env var or using default)
LLM_MODELS_ROOT="${LLM_MODELS_ROOT:-/scratch.trt_llm_data/llm-models}"
TEST_DATA_DIR="$LLM_MODELS_ROOT/multimodals/test_data"
echo "Checking test data directory: $TEST_DATA_DIR"
# Check if directory exists
if [ ! -d "$TEST_DATA_DIR" ]; then
echo "ERROR: Test data directory does not exist: $TEST_DATA_DIR"
exit 1
fi
# Check each required file
files=("seashore.png" "inpaint.png" "61.jpg" "OAI-sora-tokyo-walk.mp4")
missing_files=()
for file in "${files[@]}"; do
if [ ! -f "$TEST_DATA_DIR/$file" ]; then
missing_files+=("$file")
fi
done
if [ ${#missing_files[@]} -gt 0 ]; then
echo "ERROR: Missing test data files:"
printf ' - %s\n' "${missing_files[@]}"
exit 1
else
echo "SUCCESS: All required test data files exist"
ls -lh "$TEST_DATA_DIR"
fi
Length of output: 182
Test data directory missing: tests will fail
The directory ${LLM_MODELS_ROOT}/multimodals/test_data
(used by test_data_root
in test_modeling_qwen2_5vl.py
) does not exist. Add the multimodals/test_data
folder with the required files or update test_data_root
to point at the correct location before running these tests.
PR_Github #20351 [ run ] triggered by Bot |
PR_Github #20351 [ run ] completed with state |
Summary by CodeRabbit