From 0c8a7840fc0c61a895c4794f78be244196b61a49 Mon Sep 17 00:00:00 2001 From: IlyasMoutawwakil Date: Tue, 23 Apr 2024 11:30:26 +0200 Subject: [PATCH] added offline test --- .github/workflows/test_offline.yaml | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/test_offline.yaml diff --git a/.github/workflows/test_offline.yaml b/.github/workflows/test_offline.yaml new file mode 100644 index 0000000000..3d0d8ceb7b --- /dev/null +++ b/.github/workflows/test_offline.yaml @@ -0,0 +1,40 @@ +name: Offline usage / Python - Test + +on: + push: + branches: + - main + - hub-offline* + pull_request: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + strategy: + fail-fast: false + matrix: + python-version: [3.9] + os: [ubuntu-latest] + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies for pytorch export + run: | + pip install .[tests,openvino] + - name: Test with unittest + run: | + HF_HOME=/tmp/ huggingface-cli download hf-internal-testing/tiny-random-gpt2 + HF_HOME=/tmp/ HF_HUB_OFFLINE=1 optimum-cli export openvino --model hf-internal-testing/tiny-random-gpt2 gpt2_openvino --task text-generation + huggingface-cli download hf-internal-testing/tiny-random-gpt2 + HF_HUB_OFFLINE=1 optimum-cli export openvino --model hf-internal-testing/tiny-random-gpt2 gpt2_openvino --task text-generation + pytest tests/openvino/test_modeling.py -k "test_load_model_from_hub and not from_hub_openvino" -s -vvvvv + HF_HUB_OFFLINE=1 pytest tests/openvinoruntime/test_modeling.py -k "test_load_model_from_hub and not from_hub_openvino" -s -vvvvv