@@ -622,19 +622,59 @@ def test_qnn_backend_index(self):
622622 def test_qnn_backend_index_copy (self ):
623623 test_comb = [
624624 {
625- QCOM_MODULE : IndexCopy (skip_mutable_buffer = False ), # noqa: F405
625+ QCOM_MODULE : IndexCopy ( # noqa: F405
626+ copy_dim = 1 , skip_mutable_buffer = False
627+ ),
626628 QCOM_SAMPLE_INPUTS : (
627629 torch .tensor ([2 ], dtype = torch .int64 ),
628630 torch .randn ([1 , 1 , 12 , 64 ]),
629631 ),
630632 },
631633 {
632- QCOM_MODULE : IndexCopy (skip_mutable_buffer = True ), # noqa: F405
634+ QCOM_MODULE : IndexCopy ( # noqa: F405
635+ copy_dim = 2 , skip_mutable_buffer = False
636+ ),
637+ QCOM_SAMPLE_INPUTS : (
638+ torch .tensor ([2 ], dtype = torch .int64 ),
639+ torch .randn ([1 , 1024 , 1 , 64 ]),
640+ ),
641+ },
642+ {
643+ QCOM_MODULE : IndexCopy ( # noqa: F405
644+ copy_dim = 2 , skip_mutable_buffer = False
645+ ),
646+ QCOM_SAMPLE_INPUTS : (
647+ torch .tensor ([2 , 5 ], dtype = torch .int64 ),
648+ torch .randn ([1 , 1024 , 2 , 64 ]),
649+ ),
650+ },
651+ {
652+ QCOM_MODULE : IndexCopy ( # noqa: F405
653+ copy_dim = 1 , skip_mutable_buffer = True
654+ ),
633655 QCOM_SAMPLE_INPUTS : (
634656 torch .tensor ([2 ], dtype = torch .int64 ),
635657 torch .randn ([1 , 1 , 12 , 64 ]),
636658 ),
637659 },
660+ {
661+ QCOM_MODULE : IndexCopy ( # noqa: F405
662+ copy_dim = 2 , skip_mutable_buffer = True
663+ ),
664+ QCOM_SAMPLE_INPUTS : (
665+ torch .tensor ([2 ], dtype = torch .int64 ),
666+ torch .randn ([1 , 1024 , 1 , 64 ]),
667+ ),
668+ },
669+ {
670+ QCOM_MODULE : IndexCopy ( # noqa: F405
671+ copy_dim = 2 , skip_mutable_buffer = True
672+ ),
673+ QCOM_SAMPLE_INPUTS : (
674+ torch .tensor ([2 , 5 ], dtype = torch .int64 ),
675+ torch .randn ([1 , 1024 , 2 , 64 ]),
676+ ),
677+ },
638678 ]
639679 for i , test in enumerate (test_comb ):
640680 with self .subTest (i = i ):
@@ -1907,19 +1947,59 @@ def test_qnn_backend_index(self):
19071947 def test_qnn_backend_index_copy (self ):
19081948 test_comb = [
19091949 {
1910- QCOM_MODULE : IndexCopy (skip_mutable_buffer = False ), # noqa: F405
1950+ QCOM_MODULE : IndexCopy ( # noqa: F405
1951+ copy_dim = 1 , skip_mutable_buffer = False
1952+ ),
19111953 QCOM_SAMPLE_INPUTS : (
19121954 torch .tensor ([2 ], dtype = torch .int64 ),
19131955 torch .randn ([1 , 1 , 12 , 64 ]),
19141956 ),
19151957 },
19161958 {
1917- QCOM_MODULE : IndexCopy (skip_mutable_buffer = True ), # noqa: F405
1959+ QCOM_MODULE : IndexCopy ( # noqa: F405
1960+ copy_dim = 2 , skip_mutable_buffer = False
1961+ ),
1962+ QCOM_SAMPLE_INPUTS : (
1963+ torch .tensor ([2 ], dtype = torch .int64 ),
1964+ torch .randn ([1 , 1024 , 1 , 64 ]),
1965+ ),
1966+ },
1967+ {
1968+ QCOM_MODULE : IndexCopy ( # noqa: F405
1969+ copy_dim = 2 , skip_mutable_buffer = False
1970+ ),
1971+ QCOM_SAMPLE_INPUTS : (
1972+ torch .tensor ([2 , 5 ], dtype = torch .int64 ),
1973+ torch .randn ([1 , 1024 , 2 , 64 ]),
1974+ ),
1975+ },
1976+ {
1977+ QCOM_MODULE : IndexCopy ( # noqa: F405
1978+ copy_dim = 1 , skip_mutable_buffer = True
1979+ ),
19181980 QCOM_SAMPLE_INPUTS : (
19191981 torch .tensor ([2 ], dtype = torch .int64 ),
19201982 torch .randn ([1 , 1 , 12 , 64 ]),
19211983 ),
19221984 },
1985+ {
1986+ QCOM_MODULE : IndexCopy ( # noqa: F405
1987+ copy_dim = 2 , skip_mutable_buffer = True
1988+ ),
1989+ QCOM_SAMPLE_INPUTS : (
1990+ torch .tensor ([2 ], dtype = torch .int64 ),
1991+ torch .randn ([1 , 1024 , 1 , 64 ]),
1992+ ),
1993+ },
1994+ {
1995+ QCOM_MODULE : IndexCopy ( # noqa: F405
1996+ copy_dim = 2 , skip_mutable_buffer = True
1997+ ),
1998+ QCOM_SAMPLE_INPUTS : (
1999+ torch .tensor ([2 , 5 ], dtype = torch .int64 ),
2000+ torch .randn ([1 , 1024 , 2 , 64 ]),
2001+ ),
2002+ },
19232003 ]
19242004 for i , test in enumerate (test_comb ):
19252005 with self .subTest (i = i ):
@@ -4909,6 +4989,39 @@ def test_swin_transformer(self):
49094989 self .assertGreaterEqual (msg ["top_1" ], 60 )
49104990 self .assertGreaterEqual (msg ["top_5" ], 80 )
49114991
4992+ def test_whisper (self ):
4993+ if not self .required_envs ():
4994+ self .skipTest ("missing required envs" )
4995+
4996+ cmds = [
4997+ "python" ,
4998+ f"{ self .executorch_root } /examples/qualcomm/oss_scripts/whisper/whisper.py" ,
4999+ "--artifact" ,
5000+ self .artifact_dir ,
5001+ "--build_folder" ,
5002+ self .build_folder ,
5003+ "--device" ,
5004+ self .device ,
5005+ "--model" ,
5006+ self .model ,
5007+ "--ip" ,
5008+ self .ip ,
5009+ "--port" ,
5010+ str (self .port ),
5011+ ]
5012+ if self .host :
5013+ cmds .extend (["--host" , self .host ])
5014+
5015+ p = subprocess .Popen (cmds , stdout = subprocess .DEVNULL )
5016+ with Listener ((self .ip , self .port )) as listener :
5017+ conn = listener .accept ()
5018+ p .communicate ()
5019+ msg = json .loads (conn .recv ())
5020+ if "Error" in msg :
5021+ self .fail (msg ["Error" ])
5022+ else :
5023+ self .assertLessEqual (msg ["wer" ], 0.25 )
5024+
49125025
49135026class TestExampleQaihubScript (TestQNN ):
49145027 def test_utils_export (self ):
0 commit comments