Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/models448.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: MODELS - 4.48.3

on:
push:
pull_request:
types:
- closed
branches:
- main

jobs:
run:
name: to-${{ matrix.torch }}-tr-${{ matrix.transformers }}-ci ${{ matrix.os }}-${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ['3.12']
transformers: ['4.48.3']
torch: ['main']
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install pytorch ${{ matrix.torch }}
run: |
if [[ "${{ matrix.torch }}" == "main" ]]; then
python -m pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
else
echo "install torch==${{ matrix.torch }} torchvision torchaudio"
pip install torch==${{ matrix.torch }} torchvision torchaudio
fi

- name: Install transformers ${{ matrix.transformers }}
run: |
if [[ "${{ matrix.transformers }}" == "main" ]]; then
echo "install transformers from github"
git clone https://github.com/huggingface/transformers.git
cd transformers
pip install -e .
cd ..
else
echo "install transformers==${{ matrix.transformers }}"
pip install transformers==${{ matrix.transformers }}
fi

- name: Install peft==0.17.1
run: pip install peft==0.17.1 backoff

- name: Install requirements
run: python -m pip install -r requirements.txt

- name: Install requirements dev
run: python -m pip install -r requirements-dev.txt

- name: Uninstall onnx-diagnostic
run: python -m pip uninstall -y onnx-diagnostic

- name: pip freeze
run: python -m pip freeze

- name: Phi-4-multimodal-instruct - vision
run: |
PYTHONPATH=. python -m onnx_diagnostic.ci_models.export_phi4_mm -m microsoft/Phi-4-multimodal-instruct --device cpu --dtype float16 --exporter custom --no-pretrained --no-second-input --atol 100000164640 --mismatch01 1 --part vision
2 changes: 1 addition & 1 deletion CHANGELOGS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Change Logs
+++++

* :pr:`363`: patch for DynamicDimConstraintPrinter
* :pr:`360`: preliminary work for phi4
* :pr:`360`, :pr:`364`: preliminary work for phi4

0.8.6
+++++
Expand Down
Binary file added _small_data/American_Flamingo_JG.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions _small_data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source: wikipedia
Binary file added _small_data/RedcrestedTuraco.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions _unittests/ut_torch_export_patches/test_patch_loops.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,18 @@ def scan_filter_position_ids(
):

def body(p_attn_mask, position_ids_row):
h_len = torch.tensor(1, dtype=p_attn_mask.dtype) / p_attn_mask[:, 0].sum()
w_len = torch.tensor(1, dtype=p_attn_mask.dtype) / p_attn_mask[0].sum()
h_len = torch.tensor(1, dtype=boundaries.dtype) / p_attn_mask[:, 0].sum()
w_len = torch.tensor(1, dtype=boundaries.dtype) / p_attn_mask[0].sum()
torch._check(h_len.item() > 0)
fractional_coords_h = torch.arange(
torch.tensor(0.0, dtype=p_attn_mask.dtype),
torch.tensor(1 - 1e-6, dtype=p_attn_mask.dtype),
torch.tensor(0.0, dtype=boundaries.dtype),
torch.tensor(1 - 1e-6, dtype=boundaries.dtype),
h_len,
)
torch._check(w_len.item() > 0)
fractional_coords_w = torch.arange(
torch.tensor(0.0, dtype=p_attn_mask.dtype),
torch.tensor(1 - 1e-6, dtype=p_attn_mask.dtype),
torch.tensor(0.0, dtype=boundaries.dtype),
torch.tensor(1 - 1e-6, dtype=boundaries.dtype),
w_len,
)

Expand Down
19 changes: 12 additions & 7 deletions onnx_diagnostic/ci_models/ci_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import time
import subprocess
from argparse import ArgumentParser, BooleanOptionalAction
from argparse import ArgumentParser, BooleanOptionalAction, RawTextHelpFormatter
from typing import Any, Dict, List, Tuple
import onnx

Expand Down Expand Up @@ -50,10 +50,13 @@ def get_torch_dtype_from_command_line_args(dtype: str) -> "torch.dtype": # noqa
return torch_dtype[dtype]


def get_parser(name: str) -> ArgumentParser:
def get_parser(name: str, epilog: str = "") -> ArgumentParser:
"""Creates a default parser for many models."""
parser = ArgumentParser(
prog=name, description=f"""Export command line for model {name!r}."""
prog=name,
description=f"""Export command line for model {name!r}.""",
epilog=epilog,
formatter_class=RawTextHelpFormatter,
)
parser.add_argument(
"-m",
Expand Down Expand Up @@ -110,7 +113,7 @@ def get_parser(name: str) -> ArgumentParser:
"-a",
"--atol",
type=float,
default=1.0,
default=2.0,
help="fails if the maximum discrepancy is above that threshold",
)
parser.add_argument(
Expand Down Expand Up @@ -311,7 +314,8 @@ def fprint(s):
diff = max_diff(flat_export_expected, small, hist=[0.1, 0.01])
fprint(f"-- discrepancies={diff}")
assert diff["abs"] <= atol and diff["rep"][">0.1"] / diff["n"] <= mismatch01, (
f"absolution tolerance is above {atol} or number of mismatches is above "
f"absolute error {diff['abs']} is above {atol} or number of "
f"mismatches ({diff['rep']['>0.1'] / diff['n']}) is above "
f"{mismatch01}, dicrepancies={string_diff(diff)}"
)

Expand Down Expand Up @@ -362,8 +366,9 @@ def fprint(s):
assert (
diff["abs"] <= atol and diff["rep"][">0.1"] / diff["n"] <= mismatch01
), (
f"absolution tolerance is above {atol} or number of mismatches is "
f"above {mismatch01}, dicrepancies={string_diff(diff)}"
f"absolute error {diff['abs']} is above {atol} or number "
f" of mismatches ({diff['rep']['>0.1'] / diff['n']}) "
f"is above {mismatch01}, dicrepancies={string_diff(diff)}"
)
js = string_diff(diff, js=True, ratio=True, inputs=se, **info)
fs.write(js)
Expand Down
Loading
Loading