Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ def get_pass_name(cls) -> bool:
def need_rewrite(self, traced_module: fx.GraphModule) -> bool:
if 0 not in self.axes:
return False
for node in traced_module.graph.nodes:
if node.op == "call_method" and node.target == "expand":
return True
return False
return any(self._node_need_rewrite(node) for node in traced_module.graph.nodes)

def _node_need_rewrite(self, node) -> bool:
if not (node.op == "call_method"):
Expand Down Expand Up @@ -91,6 +88,10 @@ def rewrite(self, traced_module: fx.GraphModule) -> fx.GraphModule:
else:
# Do nothing.
pass
elif axis_idx == 0 and input_dim_size == 1 and target_dim > 1:
matched_axis = 0
else:
pass

if matched_axis != -1:
# Found a matching dynamic axis (matched_axis), replace it with a size() call
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,54 @@
{"framework": "torch", "num_devices_required": 1, "num_nodes_required": 1, "dynamic": false, "model_name": "cross-encoder/mmarco-mMiniLMv2-L12-H384-v1", "source": "huggingface_hub", "original_tag": ["sentence-transformers", "pytorch", "onnx", "safetensors", "openvino", "xlm-roberta", "text-classification", "transformers", "text-ranking", "en", "ar", "zh", "nl", "fr", "de", "hi", "in", "it", "ja", "pt", "ru", "es", "vi", "multilingual", "dataset:unicamp-dl/mmarco", "base_model:nreimers/mMiniLMv2-L12-H384-distilled-from-XLMR-Large", "base_model:quantized:nreimers/mMiniLMv2-L12-H384-distilled-from-XLMR-Large", "license:apache-2.0", "region:us"], "heuristic_tag": "nlp", "dimension_generalization_passes": ["naive_call_method_view_pass", "tuple_arg_call_method_view_pass", "naive_call_method_reshape_pass", "naive_call_method_expand_pass", "non_batch_call_method_expand_pass", "non_batch_call_function_arange_pass", "non_batch_call_function_getitem_slice_pass", "non_batch_call_function_full_pass", "non_batch_call_function_full_plus_one_pass", "non_batch_call_function_zeros_pass", "non_batch_call_function_arange_plus_one_pass"]}
{
"framework": "torch",
"num_devices_required": 1,
"num_nodes_required": 1,
"dynamic": false,
"model_name": "cross-encoder/mmarco-mMiniLMv2-L12-H384-v1",
"source": "huggingface_hub",
"original_tag": [
"sentence-transformers",
"pytorch",
"onnx",
"safetensors",
"openvino",
"xlm-roberta",
"text-classification",
"transformers",
"text-ranking",
"en",
"ar",
"zh",
"nl",
"fr",
"de",
"hi",
"in",
"it",
"ja",
"pt",
"ru",
"es",
"vi",
"multilingual",
"dataset:unicamp-dl/mmarco",
"base_model:nreimers/mMiniLMv2-L12-H384-distilled-from-XLMR-Large",
"base_model:quantized:nreimers/mMiniLMv2-L12-H384-distilled-from-XLMR-Large",
"license:apache-2.0",
"region:us"
],
"heuristic_tag": "nlp",
"dimension_generalization_passes": [
"batch_call_method_view_pass",
"tuple_arg_call_method_view_pass",
"naive_call_method_reshape_pass",
"naive_call_method_expand_pass",
"non_batch_call_method_expand_pass",
"non_batch_call_function_arange_pass",
"non_batch_call_function_getitem_slice_pass",
"non_batch_call_function_full_pass",
"non_batch_call_function_full_plus_one_pass",
"non_batch_call_function_zeros_pass",
"non_batch_call_function_arange_plus_one_pass"
],
"symbolic_dimension_reifier": "naive_nlp_sym_dim_reifier"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
{"framework": "torch", "num_devices_required": 1, "num_nodes_required": 1, "dynamic": false, "model_name": "cross-encoder/msmarco-MiniLM-L12-en-de-v1", "source": "huggingface_hub", "original_tag": ["sentence-transformers", "pytorch", "onnx", "safetensors", "openvino", "bert", "text-classification", "transformers", "text-ranking", "en", "de", "dataset:sentence-transformers/msmarco", "base_model:microsoft/Multilingual-MiniLM-L12-H384", "base_model:quantized:microsoft/Multilingual-MiniLM-L12-H384", "license:apache-2.0", "region:us"], "heuristic_tag": "nlp", "dimension_generalization_passes": ["naive_call_method_view_pass", "tuple_arg_call_method_view_pass", "naive_call_method_reshape_pass", "naive_call_method_expand_pass", "non_batch_call_method_expand_pass", "non_batch_call_function_arange_pass", "non_batch_call_function_getitem_slice_pass", "non_batch_call_function_full_pass", "non_batch_call_function_full_plus_one_pass", "non_batch_call_function_zeros_pass", "non_batch_call_function_arange_plus_one_pass"]}
{
"framework": "torch",
"num_devices_required": 1,
"num_nodes_required": 1,
"dynamic": false,
"model_name": "cross-encoder/msmarco-MiniLM-L12-en-de-v1",
"source": "huggingface_hub",
"original_tag": [
"sentence-transformers",
"pytorch",
"onnx",
"safetensors",
"openvino",
"bert",
"text-classification",
"transformers",
"text-ranking",
"en",
"de",
"dataset:sentence-transformers/msmarco",
"base_model:microsoft/Multilingual-MiniLM-L12-H384",
"base_model:quantized:microsoft/Multilingual-MiniLM-L12-H384",
"license:apache-2.0",
"region:us"
],
"heuristic_tag": "nlp",
"dimension_generalization_passes": [
"batch_call_method_view_pass",
"tuple_arg_call_method_view_pass",
"naive_call_method_reshape_pass",
"naive_call_method_expand_pass",
"non_batch_call_method_expand_pass",
"non_batch_call_function_arange_pass",
"non_batch_call_function_getitem_slice_pass",
"non_batch_call_function_full_pass",
"non_batch_call_function_full_plus_one_pass",
"non_batch_call_function_zeros_pass",
"non_batch_call_function_arange_plus_one_pass"
],
"symbolic_dimension_reifier": "naive_nlp_sym_dim_reifier"
}
Loading