Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows and onnx dtype compatibility #1886

Merged
merged 12 commits into from
Jun 24, 2024
15 changes: 12 additions & 3 deletions tests/onnxruntime/test_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ def test_load_model_from_empty_cache(self):
dirpath = os.path.join(default_cache_path, "models--" + self.TINY_ONNX_MODEL_ID.replace("/", "--"))

if os.path.exists(dirpath) and os.path.isdir(dirpath):
shutil.rmtree(dirpath)
if os.name == "nt":
os.system(f"rmdir /S /Q {dirpath}")
else:
shutil.rmtree(dirpath)
IlyasMoutawwakil marked this conversation as resolved.
Show resolved Hide resolved
with self.assertRaises(Exception):
_ = ORTModel.from_pretrained(self.TINY_ONNX_MODEL_ID, local_files_only=True)

Expand All @@ -204,7 +207,10 @@ def test_load_seq2seq_model_from_empty_cache(self):
dirpath = os.path.join(default_cache_path, "models--" + self.TINY_ONNX_SEQ2SEQ_MODEL_ID.replace("/", "--"))

if os.path.exists(dirpath) and os.path.isdir(dirpath):
shutil.rmtree(dirpath)
if os.name == "nt":
os.system(f"rmdir /S /Q {dirpath}")
else:
shutil.rmtree(dirpath)
with self.assertRaises(Exception):
_ = ORTModelForSeq2SeqLM.from_pretrained(self.TINY_ONNX_SEQ2SEQ_MODEL_ID, local_files_only=True)

Expand All @@ -227,7 +233,10 @@ def test_load_stable_diffusion_model_from_empty_cache(self):
)

if os.path.exists(dirpath) and os.path.isdir(dirpath):
shutil.rmtree(dirpath)
if os.name == "nt":
os.system(f"rmdir /S /Q {dirpath}")
else:
shutil.rmtree(dirpath)
with self.assertRaises(Exception):
_ = ORTStableDiffusionPipeline.from_pretrained(
self.TINY_ONNX_STABLE_DIFFUSION_MODEL_ID, local_files_only=True
Expand Down