Rename second input dimension from "sequence" to "num_channels" for CV models (#17976)

This commit is contained in:
regisss
2022-08-18 15:13:54 +02:00
committed by GitHub
parent 780253ce3d
commit 76454b08c8
10 changed files with 11 additions and 10 deletions

View File

@@ -194,7 +194,7 @@ class BeitOnnxConfig(OnnxConfig):
def inputs(self) -> Mapping[str, Mapping[int, str]]: def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict( return OrderedDict(
[ [
("pixel_values", {0: "batch", 1: "sequence"}), ("pixel_values", {0: "batch", 1: "num_channels"}),
] ]
) )

View File

@@ -117,7 +117,7 @@ class ConvNextOnnxConfig(OnnxConfig):
def inputs(self) -> Mapping[str, Mapping[int, str]]: def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict( return OrderedDict(
[ [
("pixel_values", {0: "batch", 1: "sequence"}), ("pixel_values", {0: "batch", 1: "num_channels"}),
] ]
) )

View File

@@ -193,7 +193,7 @@ class Data2VecVisionOnnxConfig(OnnxConfig):
def inputs(self) -> Mapping[str, Mapping[int, str]]: def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict( return OrderedDict(
[ [
("pixel_values", {0: "batch", 1: "sequence"}), ("pixel_values", {0: "batch", 1: "num_channels"}),
] ]
) )

View File

@@ -137,7 +137,7 @@ class DeiTOnnxConfig(OnnxConfig):
def inputs(self) -> Mapping[str, Mapping[int, str]]: def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict( return OrderedDict(
[ [
("pixel_values", {0: "batch", 1: "sequence"}), ("pixel_values", {0: "batch", 1: "num_channels"}),
] ]
) )

View File

@@ -220,8 +220,8 @@ class DetrOnnxConfig(OnnxConfig):
def inputs(self) -> Mapping[str, Mapping[int, str]]: def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict( return OrderedDict(
[ [
("pixel_values", {0: "batch", 1: "sequence"}), ("pixel_values", {0: "batch", 1: "num_channels"}),
("pixel_mask", {0: "batch", 1: "sequence"}), ("pixel_mask", {0: "batch"}),
] ]
) )

View File

@@ -212,7 +212,7 @@ class LayoutLMv3OnnxConfig(OnnxConfig):
("input_ids", {0: "batch", 1: "sequence"}), ("input_ids", {0: "batch", 1: "sequence"}),
("bbox", {0: "batch", 1: "sequence"}), ("bbox", {0: "batch", 1: "sequence"}),
("attention_mask", {0: "batch", 1: "sequence"}), ("attention_mask", {0: "batch", 1: "sequence"}),
("pixel_values", {0: "batch", 1: "sequence"}), ("pixel_values", {0: "batch", 1: "num_channels"}),
] ]
) )

View File

@@ -171,7 +171,7 @@ class MobileViTOnnxConfig(OnnxConfig):
@property @property
def inputs(self) -> Mapping[str, Mapping[int, str]]: def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict([("pixel_values", {0: "batch"})]) return OrderedDict([("pixel_values", {0: "batch", 1: "num_channels"})])
@property @property
def outputs(self) -> Mapping[str, Mapping[int, str]]: def outputs(self) -> Mapping[str, Mapping[int, str]]:

View File

@@ -105,7 +105,7 @@ class ResNetOnnxConfig(OnnxConfig):
def inputs(self) -> Mapping[str, Mapping[int, str]]: def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict( return OrderedDict(
[ [
("pixel_values", {0: "batch", 1: "sequence"}), ("pixel_values", {0: "batch", 1: "num_channels"}),
] ]
) )

View File

@@ -135,7 +135,7 @@ class ViTOnnxConfig(OnnxConfig):
def inputs(self) -> Mapping[str, Mapping[int, str]]: def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict( return OrderedDict(
[ [
("pixel_values", {0: "batch", 1: "sequence"}), ("pixel_values", {0: "batch", 1: "num_channels"}),
] ]
) )

View File

@@ -199,6 +199,7 @@ PYTORCH_EXPORT_MODELS = {
("roformer", "junnyu/roformer_chinese_base"), ("roformer", "junnyu/roformer_chinese_base"),
("squeezebert", "squeezebert/squeezebert-uncased"), ("squeezebert", "squeezebert/squeezebert-uncased"),
("mobilebert", "google/mobilebert-uncased"), ("mobilebert", "google/mobilebert-uncased"),
("mobilevit", "apple/mobilevit-small"),
("xlm", "xlm-clm-ende-1024"), ("xlm", "xlm-clm-ende-1024"),
("xlm-roberta", "xlm-roberta-base"), ("xlm-roberta", "xlm-roberta-base"),
("layoutlm", "microsoft/layoutlm-base-uncased"), ("layoutlm", "microsoft/layoutlm-base-uncased"),