@@ -201,9 +201,11 @@ class OVCLIExportTestCase(unittest.TestCase):
201201            "whisper" ,
202202            "int8" ,
203203            "--dataset librispeech --num-samples 1 --smooth-quant-alpha 0.9 --trust-remote-code" ,
204-             {"encoder" : 10 , "decoder" : 12 , "decoder_with_past" : 11 }
205-             if  is_transformers_version ("<=" , "4.36.0" )
206-             else  {"encoder" : 8 , "decoder" : 12 , "decoder_with_past" : 25 },
204+             (
205+                 {"encoder" : 10 , "decoder" : 12 , "decoder_with_past" : 11 }
206+                 if  is_transformers_version ("<=" , "4.36.0" )
207+                 else  {"encoder" : 8 , "decoder" : 12 , "decoder_with_past" : 25 }
208+             ),
207209            (
208210                {"encoder" : {"int8" : 8 }, "decoder" : {"int8" : 11 }, "decoder_with_past" : {"int8" : 9 }}
209211                if  is_transformers_version ("<=" , "4.36.0" )
@@ -215,9 +217,11 @@ class OVCLIExportTestCase(unittest.TestCase):
215217            "whisper" ,
216218            "f8e4m3" ,
217219            "--dataset librispeech --num-samples 1 --smooth-quant-alpha 0.9 --trust-remote-code" ,
218-             {"encoder" : 10 , "decoder" : 12 , "decoder_with_past" : 11 }
219-             if  is_transformers_version ("<=" , "4.36.0" )
220-             else  {"encoder" : 8 , "decoder" : 12 , "decoder_with_past" : 25 },
220+             (
221+                 {"encoder" : 10 , "decoder" : 12 , "decoder_with_past" : 11 }
222+                 if  is_transformers_version ("<=" , "4.36.0" )
223+                 else  {"encoder" : 8 , "decoder" : 12 , "decoder_with_past" : 25 }
224+             ),
221225            (
222226                {"encoder" : {"f8e4m3" : 8 }, "decoder" : {"f8e4m3" : 11 }, "decoder_with_past" : {"f8e4m3" : 9 }}
223227                if  is_transformers_version ("<=" , "4.36.0" )
@@ -1142,3 +1146,24 @@ def test_export_openvino_with_custom_variant(self):
11421146            model  =  eval (_HEAD_TO_AUTOMODELS ["stable-diffusion" ]).from_pretrained (tmpdir , compile = False )
11431147            for  component  in  ["text_encoder" , "tokenizer" , "unet" , "vae_encoder" , "vae_decoder" ]:
11441148                self .assertIsNotNone (getattr (model , component ))
1149+ 
1150+     def  test_export_openvino_with_revision (self ):
1151+         with  TemporaryDirectory () as  tmpdir :
1152+             subprocess .run (
1153+                 f"optimum-cli export openvino --model hf-internal-testing/tiny-random-MistralForCausalLM --revision 7158fab { tmpdir }  ,
1154+                 shell = True ,
1155+                 check = True ,
1156+             )
1157+             eval (_HEAD_TO_AUTOMODELS ["text-generation" ]).from_pretrained (tmpdir , compile = False )
1158+ 
1159+         with  TemporaryDirectory () as  tmpdir :
1160+             result  =  subprocess .run (
1161+                 f"optimum-cli export openvino --model hf-internal-testing/tiny-random-MistralForCausalLM --revision 7158fac { tmpdir }  ,
1162+                 shell = True ,
1163+                 check = False ,
1164+                 text = True ,
1165+                 stdout = subprocess .PIPE ,
1166+                 stderr = subprocess .PIPE ,
1167+             )
1168+             self .assertNotEqual (result .returncode , 0 )
1169+             self .assertIn ("not a valid git identifier" , result .stderr )
0 commit comments