Giter Club home page Giter Club logo

Comments (16)

hub-bla avatar hub-bla commented on September 23, 2024 1

Hi @nashez, the issue is still under development. I have everything implemented but this test for set_property(). I'm waiting for a response to my issue.

from openvino.

hub-bla avatar hub-bla commented on September 23, 2024 1

@almilosz I found that if you change 1 in cm.set_property({'AUTO_BATCH_TIMEOUT': 1}) to be a string it doesn't throw error so I guess there is a problem with converting this variable under the hood.

Is it enough reason for not exposing auto_batch_timeout in this issue?
Should I also create separate file for testing compiled_model?

Thank you for your hint!

Poznań? Never heard of it ;)
Must be like a GitHub project - constantly under 'maintenance' with occasional surprise updates.

from openvino.

Aryan8912 avatar Aryan8912 commented on September 23, 2024

.take

from openvino.

github-actions avatar github-actions commented on September 23, 2024

Thank you for looking into this issue! Please let us know if you have any questions or require any help.

from openvino.

p-wysocki avatar p-wysocki commented on September 23, 2024

Hello @Aryan8912, there are currently three issues with open PRs assigned to you. Please finish them before picking more tasks.

from openvino.

Plomo-02 avatar Plomo-02 commented on September 23, 2024

hello, Is it possible being assigned to this issue?

from openvino.

Plomo-02 avatar Plomo-02 commented on September 23, 2024

.take

from openvino.

github-actions avatar github-actions commented on September 23, 2024

Thank you for looking into this issue! Please let us know if you have any questions or require any help.

from openvino.

mlukasze avatar mlukasze commented on September 23, 2024

hey @Plomo-02 do you need any help?
will you have a time to continue work on this task?

from openvino.

hub-bla avatar hub-bla commented on September 23, 2024

.take

from openvino.

github-actions avatar github-actions commented on September 23, 2024

Thank you for looking into this issue! Please let us know if you have any questions or require any help.

from openvino.

hub-bla avatar hub-bla commented on September 23, 2024

Hi @almilosz @vishniakov-nikolai, I have encountered an issue while testing the implementation of CompiledModel::set_property()

  Exception from src/inference/src/cpp/compiled_model.cpp:136:
  Exception from src/plugins/intel_cpu/src/compiled_model.h:39:
  Not Implemented:
  It's not possible to set property of an already compiled model. Set property to Core::compile_model during compilation

It seems like there is a template:

// ! [compiled_model:set_property]
void ov::template_plugin::CompiledModel::set_property(const ov::AnyMap& properties) {
m_cfg = Configuration{properties, m_cfg};
}
// ! [compiled_model:set_property]

But only one plugin implements that:

void CompiledModel::set_property(const ov::AnyMap& properties) {
for (const auto& property : properties) {
if (property.first == ov::auto_batch_timeout.name()) {
m_time_out = property.second.as<std::uint32_t>();
m_config[ov::auto_batch_timeout.name()] = property.second.as<std::uint32_t>();
} else {
OPENVINO_THROW("AutoBatching Compiled Model dosen't support property",
property.first,
". The only property that can be changed on the fly is the ",
ov::auto_batch_timeout.name());
}
}
}

Other have:

void set_property(const ov::AnyMap& properties) override {
OPENVINO_THROW_NOT_IMPLEMENTED("It's not possible to set property of an already compiled model. "
"Set property to Core::compile_model during compilation");
};

My implementation so far:

Napi::Value CompiledModelWrap::set_property(const Napi::CallbackInfo &info) {
    Napi::Env env = info.Env();
    try{
        if (info.Length() != 1 || !info[0].IsObject()) {
            OPENVINO_THROW("Expected a single object argument for setting properties");
        }
        const auto properties = to_anyMap(env, info[0]);
        _compiled_model.set_property(properties);
    }catch (const std::exception& e) {
            reportError(env, e.what());
    }
    return env.Undefined();
}

My question

How should I test it?

from openvino.

nashez avatar nashez commented on September 23, 2024

@hub-bla @mlukasze Is this still under development?
If not can I take this up?

from openvino.

almilosz avatar almilosz commented on September 23, 2024

Hi @hub-bla!
Thanks for taking this issue.
CompiledModel::set_property() can be tested in Python like this:

timeout = 10
cm = core.compile_model(model, "BATCH:CPU")
cm.set_property(props.auto_batch_timeout(timeout))
assert timeout == cm.get_property('AUTO_BATCH_TIMEOUT')

To do that in Node.js API you will have to expose ov::auto_batch_timeout additionally, which may require more work.

Alternatively, you can wait as we look into the reasons why the option below is not working:

cm.set_property({'AUTO_BATCH_TIMEOUT': 1})

Let me know what you decide to do. If you have any questions, don't hesitate to ask them. You can reach me on Discord _almilosz and ask directly.

Greetings from Poznań,
Alicja

from openvino.

almilosz avatar almilosz commented on September 23, 2024

Yes, please create a test like this in a new file compiled_model.test.js file
Exposing properties will be a separate issue :)

from openvino.

hub-bla avatar hub-bla commented on September 23, 2024

I looked into the problem with conversion and I think I found the reason why.

template <>
ov::Any js_to_cpp<ov::Any>(const Napi::Env& env, const Napi::Value& value) {
if (value.IsString()) {
return ov::Any(value.ToString().Utf8Value());
} else if (value.IsBigInt()) {
Napi::BigInt big_value = value.As<Napi::BigInt>();
bool is_lossless;
int64_t big_num = big_value.Int64Value(&is_lossless);
if (!is_lossless) {
OPENVINO_THROW("Result of BigInt conversion to int64_t results in a loss of precision");
}
return ov::Any(big_num);
} else if (value.IsNumber()) {
Napi::Number num = value.ToNumber();
if (is_napi_value_int(env, value)) {
return ov::Any(num.Int32Value());
} else {
return ov::Any(num.DoubleValue());
}
} else if (value.IsBoolean()) {
return ov::Any(value.ToBoolean());
} else {
OPENVINO_THROW("Cannot convert to ov::Any");
}
}

js_to_cpp which is used in to_anyMap returns int32_t
But in auto-batch CompiledModel::set_property we can see it tries to convert it as uint32_t
void CompiledModel::set_property(const ov::AnyMap& properties) {
for (const auto& property : properties) {
if (property.first == ov::auto_batch_timeout.name()) {
m_time_out = property.second.as<std::uint32_t>();
m_config[ov::auto_batch_timeout.name()] = property.second.as<std::uint32_t>();
} else {
OPENVINO_THROW("AutoBatching Compiled Model dosen't support property",
property.first,
". The only property that can be changed on the fly is the ",
ov::auto_batch_timeout.name());
}
}
}

and .as<std::uint32_t>() is the operation that fails
as() {
impl_check();
if (_impl->is(typeid(decay_t<T>))) {
return *static_cast<decay_t<T>*>(_impl->addressof());
} else if (_impl->is(typeid(std::string))) {
_temp = std::make_shared<Impl<decay_t<T>>>();
_impl->read_to(*_temp);
return *static_cast<decay_t<T>*>(_temp->addressof());
}
for (const auto& type_index : _impl->base_type_info()) {
if (util::equal(type_index, typeid(decay_t<T>))) {
return *static_cast<decay_t<T>*>(_impl->addressof());
}
}
OPENVINO_THROW("Bad cast from: ", _impl->type_info().name(), " to: ", typeid(T).name());
}

from openvino.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.