-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NPUW] Serialization tests #29077
base: master
Are you sure you want to change the base?
[NPUW] Serialization tests #29077
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this is some very basic tests, do you plan to add more? E.g., serialize/deserialize a tiny synthetic model? Not necessarily an LLM.
void ov::npuw::s11n::read(std::istream& stream, ov::npuw::compiled::Spatial& var) { | ||
using ov::npuw::s11n::read; | ||
|
||
ov::npuw::compiled::Spatial spat; | ||
std::size_t params_size = 0; | ||
read(stream, params_size); | ||
for (std::size_t i = 0; i < params_size; ++i) { | ||
ov::npuw::compiled::Spatial::Param p; | ||
read(stream, p.idx); | ||
read(stream, p.dim); | ||
spat.params.push_back(p); | ||
var.params.push_back(p); | ||
} | ||
read(stream, spat.range); | ||
read(stream, spat.nway); | ||
read(stream, spat.out_dim); | ||
read(stream, spat.nway_iters); | ||
read(stream, spat.tail_size); | ||
read(stream, var.range); | ||
read(stream, var.nway); | ||
read(stream, var.out_dim); | ||
read(stream, var.nway_iters); | ||
read(stream, var.tail_size); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like our AOT spatial blobs didn't work till this very moment :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It did. Only SPATIAL config was broken
int tmp = 42; | ||
ov::Any var(tmp); | ||
ov::Any res; | ||
|
||
std::stringstream ss; | ||
|
||
write_any(ss, var); | ||
read_any(ss, res); | ||
|
||
EXPECT_EQ(var.as<int>(), res.as<int>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it have more types? at least two more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
TEST(SerializationTest, BasicTypes_array) { | ||
using namespace ov::npuw::s11n; | ||
|
||
std::array<uint8_t, 6> res; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it must have its own type. at least a typedef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
write_weightless(ss, {var}, ctx); | ||
read_weightless(ss, res, nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test says "with_weights"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but there is no way to test proper weightless mode - we don't have a model - thus no weights. write_weightsless
does support both cases - it tries to write as weightless, but if it's not possible - it will serialize full Tensor
I agree, but I had to remove several tests due to API and lack of model limitations. I can't test weights bank or LazyTensor as a separate entity. I will try to add a test on dummy model export/import |
Not possible to add dummy model test on LLMCompiledModel due to internal passes and CompiledModel doesn't support export. I suggest it to be added separately in the next PR |
No description provided.