Fix GPTQ model conversion after two breaking changes (#20823)

* Fix GPTQ model conversion after two breaking changes

* Code style fix

* Remove redundant check
This commit is contained in:
Sergey Lyalin 2023-11-03 13:47:51 +04:00 committed by GitHub
parent 3386b85c08
commit 1960536e8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -85,8 +85,7 @@ U4BlockRepack::U4BlockRepack() {
}
}
copy_runtime_info({std::move(constant), std::move(reshape1), std::move(transpose), std::move(reshape2)},
new_const);
copy_runtime_info({std::move(constant), std::move(reshape1), std::move(transpose), reshape2}, new_const);
replace_node(reshape2, new_const);
return true;

View File

@ -5,6 +5,7 @@
#include "utils_quantize.hpp"
#include "openvino/frontend/pytorch/node_context.hpp"
#include "openvino/op/bitwise_and.hpp"
#include "openvino/op/broadcast.hpp"
#include "openvino/op/constant.hpp"
#include "openvino/op/convert.hpp"
@ -175,9 +176,15 @@ std::shared_ptr<Node> u4_compression_stack(const OutputVector& list_elems, int64
if (list_elems.size() != 2)
return nullptr;
auto bitwise_and = cast_fw_node(list_elems[0].get_node_shared_ptr(), "aten::bitwise_and");
if (!bitwise_and)
return nullptr;
auto bitwise_and_candidate = list_elems[0].get_node_shared_ptr();
std::shared_ptr<Node> bitwise_and = cast_fw_node(bitwise_and_candidate, "aten::bitwise_and");
if (!bitwise_and) {
bitwise_and = std::dynamic_pointer_cast<v13::BitwiseAnd>(bitwise_and_candidate);
if (!bitwise_and)
return nullptr;
}
auto bitwise_shift = cast_fw_node(list_elems[1].get_node_shared_ptr(), "aten::bitwise_right_shift");
if (!bitwise_shift)
return nullptr;