Skip to content

Commit 6790042

Browse files
committed
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]
1 parent d4b7ed8 commit 6790042

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

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):

examples/models/llama3_2_vision/preprocess/test_preprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ def initialize_models(resize_to_max_canvas: bool) -> Dict[str, Any]:
5959
reference_model = CLIPImageTransform(
6060
image_mean=config.image_mean,
6161
image_std=config.image_std,
62-
resize_to_max_canvas=config.resize_to_max_canvas,
6362
resample=config.resample,
6463
antialias=config.antialias,
6564
tile_size=config.tile_size,
6665
max_num_tiles=config.max_num_tiles,
66+
resize_to_max_canvas=config.resize_to_max_canvas,
6767
possible_resolutions=None,
6868
)
6969

0 commit comments

Comments
 (0)