@@ -622,19 +622,59 @@ def test_qnn_backend_index(self):
622
622
def test_qnn_backend_index_copy (self ):
623
623
test_comb = [
624
624
{
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
+ ),
626
628
QCOM_SAMPLE_INPUTS : (
627
629
torch .tensor ([2 ], dtype = torch .int64 ),
628
630
torch .randn ([1 , 1 , 12 , 64 ]),
629
631
),
630
632
},
631
633
{
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
+ ),
633
655
QCOM_SAMPLE_INPUTS : (
634
656
torch .tensor ([2 ], dtype = torch .int64 ),
635
657
torch .randn ([1 , 1 , 12 , 64 ]),
636
658
),
637
659
},
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
+ },
638
678
]
639
679
for i , test in enumerate (test_comb ):
640
680
with self .subTest (i = i ):
@@ -1907,19 +1947,59 @@ def test_qnn_backend_index(self):
1907
1947
def test_qnn_backend_index_copy (self ):
1908
1948
test_comb = [
1909
1949
{
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
+ ),
1911
1953
QCOM_SAMPLE_INPUTS : (
1912
1954
torch .tensor ([2 ], dtype = torch .int64 ),
1913
1955
torch .randn ([1 , 1 , 12 , 64 ]),
1914
1956
),
1915
1957
},
1916
1958
{
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
+ ),
1918
1980
QCOM_SAMPLE_INPUTS : (
1919
1981
torch .tensor ([2 ], dtype = torch .int64 ),
1920
1982
torch .randn ([1 , 1 , 12 , 64 ]),
1921
1983
),
1922
1984
},
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
+ },
1923
2003
]
1924
2004
for i , test in enumerate (test_comb ):
1925
2005
with self .subTest (i = i ):
@@ -4909,6 +4989,39 @@ def test_swin_transformer(self):
4909
4989
self .assertGreaterEqual (msg ["top_1" ], 60 )
4910
4990
self .assertGreaterEqual (msg ["top_5" ], 80 )
4911
4991
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
+
4912
5025
4913
5026
class TestExampleQaihubScript (TestQNN ):
4914
5027
def test_utils_export (self ):
0 commit comments