Skip to content

Commit

Permalink
[PT FE] Retry hf related tests (#26030)
Browse files Browse the repository at this point in the history
### Details:
 - *item1*
 - *...*

### Tickets:
 - *CVS-149231*
 - *CVS-149229*
  • Loading branch information
mvafin authored Aug 12, 2024
1 parent 7dbceea commit 96c8661
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 1 addition & 2 deletions tests/model_hub_tests/pytorch/test_hf_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from datasets import Audio, load_dataset
from huggingface_hub import hf_hub_download, model_info
from huggingface_hub.utils import HfHubHTTPError, LocalEntryNotFoundError
from PIL import Image
import pytest
import torch
Expand Down Expand Up @@ -56,7 +55,7 @@ def setup_class(self):
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
self.image = Image.open(requests.get(url, stream=True).raw)

@retry(3, exceptions=(HfHubHTTPError, LocalEntryNotFoundError), delay=1)
@retry(3, exceptions=(OSError,), delay=1)
def load_model(self, name, type):
name, _, name_suffix = name.partition(':')

Expand Down
3 changes: 1 addition & 2 deletions tests/model_hub_tests/pytorch/test_timm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import pytest
import timm
import torch
from huggingface_hub.utils import HfHubHTTPError, LocalEntryNotFoundError
from models_hub_common.utils import get_models_list, retry

from torch_utils import TestTorchConvertModel
Expand Down Expand Up @@ -48,7 +47,7 @@ def filter_timm(timm_list: list) -> list:


class TestTimmConvertModel(TestTorchConvertModel):
@retry(3, exceptions=(HfHubHTTPError, LocalEntryNotFoundError), delay=1)
@retry(3, exceptions=(OSError,), delay=1)
def load_model(self, model_name, model_link):
m = timm.create_model(model_name, pretrained=True)
cfg = timm.get_pretrained_cfg(model_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
from openvino._offline_transformations import paged_attention_transformation
from openvino._pyopenvino.op import _PagedAttentionExtension
from optimum.intel import OVModelForCausalLM
from models_hub_common.utils import retry
import models_hub_common.utils as utils
import pytest
import os
import re

@retry(3, exceptions=(OSError,), delay=1)
def run_pa(tmp_path, model_id, model_link, use_block_indices_inputs, use_score_outputs):
model = OVModelForCausalLM.from_pretrained(model_id, export=True, trust_remote_code=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import openvino as ov
from openvino._offline_transformations import stateful_to_stateless_transformation
from optimum.intel import OVModelForCausalLM
from models_hub_common.utils import retry
import models_hub_common.utils as utils
import pytest
import os
Expand All @@ -23,6 +24,7 @@ def check_desc_tensors(tensors1, tensors2):
assert t1.get_partial_shape() == t2.get_partial_shape()
assert t1.get_element_type() == t2.get_element_type()

@retry(3, exceptions=(OSError,), delay=1)
def run_stateful_to_stateless_in_runtime(tmp_path, model_id, model_link):
model = OVModelForCausalLM.from_pretrained(model_id, export=True, stateful=True, compile=False)
assert len(model.model.get_sinks()), f"Input model is not in the expected stateful form because it doesn't have any sinks."
Expand Down

0 comments on commit 96c8661

Please sign in to comment.