@@ -1077,7 +1077,7 @@ def forward(
1077
1077
input_features : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1078
1078
input_values : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1079
1079
* ,
1080
- return_dict : bool = False ,
1080
+ return_dict : bool = True ,
1081
1081
** kwargs ,
1082
1082
):
1083
1083
# Warn about any unexpected kwargs using the helper method
@@ -1134,8 +1134,8 @@ def forward(
1134
1134
# TODO: This allows to support sentence-transformers models (sentence embedding), but is not validated.
1135
1135
last_hidden_state = next (iter (model_outputs .values ()))
1136
1136
1137
- if return_dict :
1138
- return { " last_hidden_state" : last_hidden_state }
1137
+ if not return_dict :
1138
+ return ( last_hidden_state ,)
1139
1139
1140
1140
# converts output to namedtuple for pipelines post-processing
1141
1141
return BaseModelOutput (last_hidden_state = last_hidden_state )
@@ -1251,7 +1251,7 @@ def forward(
1251
1251
attention_mask : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1252
1252
token_type_ids : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1253
1253
* ,
1254
- return_dict : bool = False ,
1254
+ return_dict : bool = True ,
1255
1255
** kwargs ,
1256
1256
):
1257
1257
# Warn about any unexpected kwargs using the helper method
@@ -1288,8 +1288,8 @@ def forward(
1288
1288
1289
1289
logits = model_outputs ["logits" ]
1290
1290
1291
- if return_dict :
1292
- return { " logits" : logits }
1291
+ if not return_dict :
1292
+ return ( logits ,)
1293
1293
1294
1294
# converts output to namedtuple for pipelines post-processing
1295
1295
return MaskedLMOutput (logits = logits )
@@ -1353,7 +1353,7 @@ def forward(
1353
1353
attention_mask : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1354
1354
token_type_ids : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1355
1355
* ,
1356
- return_dict : bool = False ,
1356
+ return_dict : bool = True ,
1357
1357
** kwargs ,
1358
1358
):
1359
1359
# Warn about any unexpected kwargs using the helper method
@@ -1388,8 +1388,8 @@ def forward(
1388
1388
start_logits = model_outputs ["start_logits" ]
1389
1389
end_logits = model_outputs ["end_logits" ]
1390
1390
1391
- if return_dict :
1392
- return { " start_logits" : start_logits , " end_logits" : end_logits }
1391
+ if not return_dict :
1392
+ return ( start_logits , end_logits )
1393
1393
1394
1394
# converts output to namedtuple for pipelines post-processing
1395
1395
return QuestionAnsweringModelOutput (start_logits = start_logits , end_logits = end_logits )
@@ -1468,7 +1468,7 @@ def forward(
1468
1468
attention_mask : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1469
1469
token_type_ids : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1470
1470
* ,
1471
- return_dict : bool = False ,
1471
+ return_dict : bool = True ,
1472
1472
** kwargs ,
1473
1473
):
1474
1474
# Warn about any unexpected kwargs using the helper method
@@ -1505,8 +1505,8 @@ def forward(
1505
1505
1506
1506
logits = model_outputs ["logits" ]
1507
1507
1508
- if return_dict :
1509
- return { " logits" : logits }
1508
+ if not return_dict :
1509
+ return ( logits ,)
1510
1510
1511
1511
# converts output to namedtuple for pipelines post-processing
1512
1512
return SequenceClassifierOutput (logits = logits )
@@ -1571,7 +1571,7 @@ def forward(
1571
1571
attention_mask : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1572
1572
token_type_ids : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1573
1573
* ,
1574
- return_dict : bool = False ,
1574
+ return_dict : bool = True ,
1575
1575
** kwargs ,
1576
1576
):
1577
1577
# Warn about any unexpected kwargs using the helper method
@@ -1608,8 +1608,8 @@ def forward(
1608
1608
1609
1609
logits = model_outputs ["logits" ]
1610
1610
1611
- if return_dict :
1612
- return { " logits" : logits }
1611
+ if not return_dict :
1612
+ return ( logits ,)
1613
1613
1614
1614
return TokenClassifierOutput (logits = logits )
1615
1615
@@ -1667,7 +1667,7 @@ def forward(
1667
1667
attention_mask : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1668
1668
token_type_ids : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1669
1669
* ,
1670
- return_dict : bool = False ,
1670
+ return_dict : bool = True ,
1671
1671
** kwargs ,
1672
1672
):
1673
1673
# Warn about any unexpected kwargs using the helper method
@@ -1704,8 +1704,8 @@ def forward(
1704
1704
1705
1705
logits = model_outputs ["logits" ]
1706
1706
1707
- if return_dict :
1708
- return { " logits" : logits }
1707
+ if not return_dict :
1708
+ return ( logits ,)
1709
1709
1710
1710
# converts output to namedtuple for pipelines post-processing
1711
1711
return MultipleChoiceModelOutput (logits = logits )
@@ -1770,7 +1770,7 @@ def forward(
1770
1770
self ,
1771
1771
pixel_values : Union [torch .Tensor , np .ndarray ],
1772
1772
* ,
1773
- return_dict : bool = False ,
1773
+ return_dict : bool = True ,
1774
1774
** kwargs ,
1775
1775
):
1776
1776
# Warn about any unexpected kwargs using the helper method
@@ -1802,8 +1802,8 @@ def forward(
1802
1802
1803
1803
logits = model_outputs ["logits" ]
1804
1804
1805
- if return_dict :
1806
- return { " logits" : logits }
1805
+ if not return_dict :
1806
+ return ( logits ,)
1807
1807
1808
1808
# converts output to namedtuple for pipelines post-processing
1809
1809
return ImageClassifierOutput (logits = logits )
@@ -1868,7 +1868,7 @@ def forward(
1868
1868
self ,
1869
1869
pixel_values : Union [torch .Tensor , np .ndarray ],
1870
1870
* ,
1871
- return_dict : bool = False ,
1871
+ return_dict : bool = True ,
1872
1872
** kwargs ,
1873
1873
):
1874
1874
# Warn about any unexpected kwargs using the helper method
@@ -1900,8 +1900,8 @@ def forward(
1900
1900
1901
1901
logits = model_outputs ["logits" ]
1902
1902
1903
- if return_dict :
1904
- return { " logits" : logits }
1903
+ if not return_dict :
1904
+ return ( logits ,)
1905
1905
1906
1906
# converts output to namedtuple for pipelines post-processing
1907
1907
return SemanticSegmenterOutput (logits = logits )
@@ -1996,7 +1996,7 @@ def forward(
1996
1996
attention_mask : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1997
1997
input_features : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
1998
1998
* ,
1999
- return_dict : bool = False ,
1999
+ return_dict : bool = True ,
2000
2000
** kwargs ,
2001
2001
):
2002
2002
# Warn about any unexpected kwargs using the helper method
@@ -2038,8 +2038,8 @@ def forward(
2038
2038
2039
2039
logits = model_outputs ["logits" ]
2040
2040
2041
- if return_dict :
2042
- return { " logits" : logits }
2041
+ if not return_dict :
2042
+ return ( logits ,)
2043
2043
2044
2044
# converts output to namedtuple for pipelines post-processing
2045
2045
return SequenceClassifierOutput (logits = logits )
@@ -2092,7 +2092,7 @@ def forward(
2092
2092
self ,
2093
2093
input_values : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
2094
2094
* ,
2095
- return_dict : bool = False ,
2095
+ return_dict : bool = True ,
2096
2096
** kwargs ,
2097
2097
):
2098
2098
# Warn about any unexpected kwargs using the helper method
@@ -2134,8 +2134,8 @@ def forward(
2134
2134
2135
2135
logits = model_outputs ["logits" ]
2136
2136
2137
- if return_dict :
2138
- return { " logits" : logits }
2137
+ if not return_dict :
2138
+ return ( logits ,)
2139
2139
2140
2140
# converts output to namedtuple for pipelines post-processing
2141
2141
return CausalLMOutput (logits = logits )
@@ -2196,7 +2196,7 @@ def forward(
2196
2196
self ,
2197
2197
input_values : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
2198
2198
* ,
2199
- return_dict : bool = False ,
2199
+ return_dict : bool = True ,
2200
2200
** kwargs ,
2201
2201
):
2202
2202
# Warn about any unexpected kwargs using the helper method
@@ -2231,8 +2231,8 @@ def forward(
2231
2231
logits = model_outputs ["logits" ]
2232
2232
embeddings = model_outputs ["embeddings" ]
2233
2233
2234
- if return_dict :
2235
- return { " logits" : logits , " embeddings" : embeddings }
2234
+ if not return_dict :
2235
+ return ( logits , embeddings )
2236
2236
2237
2237
# converts output to namedtuple for pipelines post-processing
2238
2238
return XVectorOutput (logits = logits , embeddings = embeddings )
@@ -2285,7 +2285,7 @@ def forward(
2285
2285
self ,
2286
2286
input_values : Optional [Union [torch .Tensor , np .ndarray ]] = None ,
2287
2287
* ,
2288
- return_dict : bool = False ,
2288
+ return_dict : bool = True ,
2289
2289
** kwargs ,
2290
2290
):
2291
2291
# Warn about any unexpected kwargs using the helper method
@@ -2305,8 +2305,8 @@ def forward(
2305
2305
2306
2306
logits = model_outputs ["logits" ]
2307
2307
2308
- if return_dict :
2309
- return { " logits" : logits }
2308
+ if not return_dict :
2309
+ return ( logits ,)
2310
2310
2311
2311
# converts output to namedtuple for pipelines post-processing
2312
2312
return TokenClassifierOutput (logits = logits )
@@ -2353,7 +2353,7 @@ def forward(
2353
2353
self ,
2354
2354
pixel_values : Union [torch .Tensor , np .ndarray ],
2355
2355
* ,
2356
- return_dict : bool = False ,
2356
+ return_dict : bool = True ,
2357
2357
** kwargs ,
2358
2358
):
2359
2359
# Warn about any unexpected kwargs using the helper method
@@ -2390,8 +2390,8 @@ def forward(
2390
2390
model_outputs = self ._prepare_onnx_outputs (use_torch , onnx_outputs )
2391
2391
reconstruction = model_outputs ["reconstruction" ]
2392
2392
2393
- if return_dict :
2394
- return { " reconstruction" : reconstruction }
2393
+ if not return_dict :
2394
+ return ( reconstruction ,)
2395
2395
2396
2396
return ImageSuperResolutionOutput (reconstruction = reconstruction )
2397
2397
0 commit comments