openvino icon indicating copy to clipboard operation
openvino copied to clipboard

[Good First Issue]: Enable Model.getOps() method

Open almilosz opened this issue 1 year ago • 9 comments

Context

OpenVINO works in Node.js environment! We are looking for new contributors who can help with enabling C++ API methods in JavaScript side.

First of all read Node.js API Contribution Guide.

Task Details

Expose ov::Model::get_ops() method. From JavaScript side it will be Model.getOps() method. This method:

  • Doesn't have parameters
  • Returns array of ov::Node objects Node.js API doesn't have bindings for ov::Node. You need implement bindings for it. ov::Node has a lot of methods, you shouldn't implement all of them. Implement:

Useful links

  • C++ API implementation of Model::get_ops() method
  • Node.js API has similar implementation for Output<ov::Node>, use this as the reference to implement ov::Node class.

What needs to be done?

  • Create NodeWrap class that inherits from Napi::ObjectWrap and represents ov::Node, create a separate header and source file.
  • Implement NodeWrap as minimal wrapper of ov::Node with ov::Node.get_name() method.
  • Add ModelWrap.get_ops() method to ./src/bindings/js/node/src/model_wrap.cpp
  • Update TypeScript definitions in ./src/bindings/js/node/lib/addon.ts
  • Create unit test for added functionality using Node.js Test Runner. It might look similar to this (Python code as an example):
  model_operators = [op.get_name().split("_")[0] for op in model.get_ops()]
     expected_ops = [
         "Subtract",
         "Transpose",
     ]
     assert len(model_operators) == 14
     for op in expected_ops:
         assert op in model_operators

How to take this issue

To take this issue leave text: .take as the comment in this issue. It will assign this issue to you automatically. Please, make sure that the issue has the status Contributors Needed and doesn't have another user in Assingnees.

Example Pull Requests

  • https://github.com/openvinotoolkit/openvino/pull/23743
  • https://github.com/openvinotoolkit/openvino/pull/24023

You may use this unfinished PR as the reference

  • https://github.com/openvinotoolkit/openvino/pull/25470

Resources

Contact points

@almilosz @vishniakov-nikolai

Please, mention us in this issue discussion if you have any questions.

almilosz avatar Jul 05 '24 13:07 almilosz

.take

spran180 avatar Jul 05 '24 16:07 spran180

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

github-actions[bot] avatar Jul 05 '24 16:07 github-actions[bot]

Reopening the task as the PR seems to have been abandoned.

p-wysocki avatar Sep 02 '24 06:09 p-wysocki

@p-wysocki @almilosz Can I take this up if no one is working on it?

nashez avatar Sep 23 '24 09:09 nashez

it would be great, have fun!

mlukasze avatar Sep 23 '24 09:09 mlukasze

.take

qxprakash avatar Oct 07 '24 06:10 qxprakash

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

github-actions[bot] avatar Oct 07 '24 06:10 github-actions[bot]

@almilosz I will give it a shot

qxprakash avatar Oct 07 '24 06:10 qxprakash

@almilosz @vishniakov-nikolai sorry I got a but busy I'll raise a pr soon

qxprakash avatar Oct 19 '24 18:10 qxprakash

If you have any issues with it, don't hesitate to ask :)

almilosz avatar Oct 21 '24 07:10 almilosz

@almilosz can you please assign this to someone else , I have been busy a lot lately so couldn't make much progress , it's better to let someone else have a shot.

qxprakash avatar Nov 04 '24 09:11 qxprakash

no worries @qxprakash thank you for your time, hope to see you again, later :)

task has been moved back to the available ones

mlukasze avatar Nov 04 '24 09:11 mlukasze

@almilosz I'd like to take up this issue:)

itsaflamingo avatar Dec 08 '24 19:12 itsaflamingo

it's yours, @itsaflamingo have fun

mlukasze avatar Dec 09 '24 05:12 mlukasze

@itsaflamingo do you need any help with it?

vishniakov-nikolai avatar Jan 15 '25 16:01 vishniakov-nikolai

@itsaflamingo do you need any help with it?

@vishniakov-nikolai I'm all good, just went away on vacation but I aim to have it finished this weekend, thanks for checking in:)

itsaflamingo avatar Jan 17 '25 03:01 itsaflamingo

@vishniakov-nikolai I finished, but now I'm running into a git error that won't let me commit my changes:

error: 'cmake/developer_package/ncc_naming_style/ncc' does not have a commit checked out fatal: updating files failed

I'll submit pull request once I've solved that:')

itsaflamingo avatar Jan 20 '25 05:01 itsaflamingo

@vishniakov-nikolai I figured it out. I made a git pull during the confusion, which updated other sets of files. Could we delete those sets of commits and simply keep the relevant ones?

itsaflamingo avatar Jan 21 '25 02:01 itsaflamingo

Hi @itsaflamingo! Yes, sure, you can perform rebase on your branch to keep only your commits and then merge master branch with latest changes. Second option is to checkout new branch from latest master and perform cherry-pick each of your commits.

For example, second option:

git checkout -b fresh-master # as I can see, you didn't create new branch for your changes, pay attention to do not lose changes that you've made
git fetch upstream # upstream it's an https://github.com/openvinotoolkit/openvino.git remote. It it doesn't exist, create it by: git remote add upstream https://github.com/openvinotoolkit/openvino.git, and then perform fetch
git reset --hard upstream/master
git checkout -b new-name-of-your-branch
git cherry-pick bd1631a3b36787dc98436965ca079457f563de99 33f5233a224b1be1a021ac59dd9a6c8cef82149c 121288d0f3dbc94b2dc92e3da6924d0a9de63e00 bf1364a6d18a7cc190e1160bc1b0c7a20123edde f01d3aa70a9df4de45c56361ccb823f5b07a36b2
git push  --set-upstream origin your-old-branch-name # in your case your-old-branch-name has name master. To do not create new PR you should perform force push to your previous branch

vishniakov-nikolai avatar Jan 21 '25 09:01 vishniakov-nikolai

Also, replace this commit bf1364a6d18a7cc190e1160bc1b0c7a20123edde by only change in src/bindings/js/node/CMakeLists.txt to avoid unnecessary submodules update

vishniakov-nikolai avatar Jan 21 '25 09:01 vishniakov-nikolai

.take

AkshatShrivastava0104 avatar Mar 14 '25 18:03 AkshatShrivastava0104

Thanks for being interested in this issue. It looks like this ticket is already assigned to a contributor. Please communicate with the assigned contributor to confirm the status of the issue.

github-actions[bot] avatar Mar 14 '25 18:03 github-actions[bot]

Hi @AkshatShrivastava0104, to participate in Google Summer of Code you have to complete Prerequisite Task. It means that you should prepare a PR with a solution to some issue. Are you still working on this one? I'd love to hear from you, Alicja

almilosz avatar Apr 07 '25 09:04 almilosz

can i work on this @almilosz ?

Saketh1702 avatar May 18 '25 20:05 Saketh1702

yes, it's open now. I can assign you :)

almilosz avatar May 19 '25 06:05 almilosz

hello, @Saketh1702 Are you still working on it? Do you have any questions?

almilosz avatar Jun 11 '25 12:06 almilosz

.take

nashez avatar Jul 06 '25 14:07 nashez

Thank you @nashez for your contribution! I encourage you to visit GFI board from time to time and take tasks you are interested in

almilosz avatar Oct 10 '25 09:10 almilosz