Skip to content

Commit 843150b

Browse files
authored
Add preprocess to ci (#6544)
* Add preprocess to ci [ghstack-poisoned] * Update on "Add preprocess to ci" 1. Run `test_preprocess.py` in ci. 2. Refactor `test_preprocess.py` by creating the model artifacts (eager, exported, et) once and then re-using them on different inputs. Test Plan: ``` python -m unittest examples.models.llama3_2_vision.preprocess.test_preprocess ``` [ghstack-poisoned] * Update on "Add preprocess to ci" 1. Run `test_preprocess.py` in ci. 2. Refactor `test_preprocess.py` by creating the model artifacts (eager, exported, et) once and then re-using them on different inputs. Test Plan: ``` python -m unittest examples.models.llama3_2_vision.preprocess.test_preprocess ``` [ghstack-poisoned] * Update on "Add preprocess to ci" 1. Run `test_preprocess.py` in ci. 2. Refactor `test_preprocess.py` by creating the model artifacts (eager, exported, et) once and re-use them on different inputs (previously, create model artifacts for each test). Test Plan: ``` python -m unittest examples.models.llama3_2_vision.preprocess.test_preprocess ``` [ghstack-poisoned] * Update on "Add preprocess to ci" 1. Run `test_preprocess.py` in ci. 2. Refactor `test_preprocess.py` by creating the model artifacts (eager, exported, et) once and re-use them on different inputs (previously, create model artifacts for each test). Test Plan: ``` python -m unittest examples.models.llama3_2_vision.preprocess.test_preprocess ``` [ghstack-poisoned] * Update on "Add preprocess to ci" 1. Run `test_preprocess.py` in ci. 2. Refactor `test_preprocess.py` by creating the model artifacts (eager, exported, et) once and re-use them on different inputs (previously, create model artifacts for each test). Test Plan: ``` pytest -c /dev/null -v -n auto examples/models/llama3_2_vision/preprocess/ ``` [ghstack-poisoned] * Update on "Add preprocess to ci" 1. Run `test_preprocess.py` in ci. 2. Refactor `test_preprocess.py` by creating the model artifacts (eager, exported, et) once and re-use them on different inputs (previously, create model artifacts for each test). Test Plan: ``` pytest -c /dev/null -v -n auto examples/models/llama3_2_vision/preprocess/ ``` [ghstack-poisoned]
1 parent c817640 commit 843150b

File tree

4 files changed

+180
-131
lines changed

4 files changed

+180
-131
lines changed

.github/workflows/_unittest.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
CMAKE_ARGS="-DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
3838
.ci/scripts/setup-linux.sh cmake
3939
40+
# Install llama3_2_vision dependencies.
41+
PYTHON_EXECUTABLE=python ./examples/models/llama3_2_vision/install_requirements.sh
42+
4043
# Run pytest with coverage
4144
pytest -n auto --cov=./ --cov-report=xml
4245
# Run gtest
@@ -67,6 +70,10 @@ jobs:
6770
${CONDA_RUN} --no-capture-output \
6871
.ci/scripts/setup-macos.sh cmake
6972
73+
# Install llama3_2_vision dependencies.
74+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
75+
./examples/models/llama3_2_vision/install_requirements.sh
76+
7077
# Run pytest with coverage
7178
${CONDA_RUN} pytest -n auto --cov=./ --cov-report=xml
7279
# Run gtest

examples/models/llama3_2_vision/preprocess/model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class PreprocessConfig:
2626
max_num_tiles: int = 4
2727
tile_size: int = 224
2828
antialias: bool = False
29+
# Used for reference eager model from torchtune.
30+
resize_to_max_canvas: bool = False
31+
possible_resolutions: Optional[List[Tuple[int, int]]] = None
2932

3033

3134
class CLIPImageTransformModel(EagerModelBase):

0 commit comments

Comments
 (0)