Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
geeky33 authored Jan 29, 2025
2 parents 97f779b + b22b526 commit d0bd6cd
Show file tree
Hide file tree
Showing 17 changed files with 135 additions and 86 deletions.
8 changes: 8 additions & 0 deletions .github/scripts/workflow_rerun/errors_to_look_for.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,13 @@
{
"error_text": "file DOWNLOAD cannot compute hash on failed download",
"ticket": 156593
},
{
"error_text": "lost communication with the server",
"ticket": 160816
},
{
"error_text": "the runner has received a shutdown signal",
"ticket": 160818
}
]
6 changes: 3 additions & 3 deletions .github/workflows/build_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ jobs:
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
- name: 'Upload sphinx.log'
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: sphinx_build_log_${{ env.PR_NUMBER }}.log
path: build/docs/sphinx.log

- name: 'Upload docs html'
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: openvino_docs_html_${{ env.PR_NUMBER }}.zip
path: build/docs/openvino_docs_html.zip
Expand All @@ -101,7 +101,7 @@ jobs:
- name: 'Upload test results'
if: failure()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: openvino_docs_pytest
path: build/docs/_artifacts/
2 changes: 1 addition & 1 deletion .github/workflows/stale_prs_and_issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
with:
stale-issue-message: 'This issue will be closed in a week because of 9 months of no activity.'
stale-pr-message: 'This PR will be closed in a week because of 2 weeks of no activity.'
Expand Down
1 change: 1 addition & 0 deletions src/bindings/js/.eslintrc-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
'key-spacing': ['error', { beforeColon: false }],
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
'keyword-spacing': ['error', { overrides: { catch: { after: false } } }],
'prefer-destructuring': ["error", { "object": true, "array": false }],
'@typescript-eslint/no-var-requires': 0,
}
};
2 changes: 1 addition & 1 deletion src/bindings/js/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build": "npm run tsc",
"prepare": "npm run build",
"lint": "eslint .",
"test_setup": "node ./tests/unit/setup.js",
"test_setup": "node ./tests/setup.js",
"test": "npm run test_setup && node --test ./tests/unit/*.test.js",
"test:e2e": "mocha ./tests/e2e/electron-app.test.js",
"tsc": "tsc",
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/js/node/tests/e2e/electron-app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const util = require('node:util');
const assert = require('node:assert');
const { exec } = require('child_process');
const execPromise = util.promisify(exec);
const { testModels, downloadTestModel } = require('../unit/utils.js');
const { testModels, downloadTestModel } = require('../utils.js');

describe('E2E testing for OpenVINO as an Electron dependency.', function() {
this.timeout(50000);
Expand Down
File renamed without changes.
30 changes: 16 additions & 14 deletions src/bindings/js/node/tests/unit/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ const { after, describe, it, before, beforeEach } = require('node:test');
const {
testModels,
compareModels,
getModelPath,
isModelAvailable,
sleep,
} = require('./utils.js');
lengthFromShape,
} = require('../utils.js');
const epsilon = 0.5;

describe('ov basic tests.', () => {
let testXml = null;
const { testModelFP32 } = testModels;
let core = null;
let model = null;
let compiledModel = null;
Expand All @@ -27,13 +27,12 @@ describe('ov basic tests.', () => {

before(async () => {
outDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'ov_js_out_'));
await isModelAvailable(testModels.testModelFP32);
testXml = getModelPath().xml;
await isModelAvailable(testModelFP32);
});

beforeEach(() => {
core = new ov.Core();
model = core.readModelSync(testXml);
model = core.readModelSync(testModelFP32.xml);
compiledModel = core.compileModelSync(model, 'CPU');
modelLike = [model, compiledModel];
});
Expand Down Expand Up @@ -139,12 +138,12 @@ describe('ov basic tests.', () => {
});

it('compileModelSync(model_path, deviceName, config: {}) ', () => {
const cm = core.compileModelSync(testXml, 'CPU', tput);
const cm = core.compileModelSync(testModelFP32.xml, 'CPU', tput);
assert.equal(cm.inputs.length, 1);
});

it('compileModelSync(model:model_path, deviceName: string) ', () => {
const cm = core.compileModelSync(testXml, 'CPU');
const cm = core.compileModelSync(testModelFP32.xml, 'CPU');
assert.deepStrictEqual(cm.output(0).shape, [1, 10]);
});

Expand Down Expand Up @@ -200,13 +199,13 @@ describe('ov basic tests.', () => {
});

it('compileModel(model_path, deviceName, config: {}) ', () => {
core.compileModel(testXml, 'CPU', tput).then((cm) => {
core.compileModel(testModelFP32.xml, 'CPU', tput).then((cm) => {
assert.equal(cm.inputs.length, 1);
});
});

it('compileModel(model:model_path, deviceName: string) ', () => {
core.compileModel(testXml, 'CPU').then((cm) => {
core.compileModel(testModelFP32.xml, 'CPU').then((cm) => {
assert.deepStrictEqual(cm.output(0).shape, [1, 10]);
});
});
Expand Down Expand Up @@ -277,8 +276,11 @@ describe('ov basic tests.', () => {
assert.strictEqual(obj.input().getAnyName(), 'data');
assert.strictEqual(obj.input().anyName, 'data');

assert.deepStrictEqual(obj.input(0).shape, [1, 3, 32, 32]);
assert.deepStrictEqual(obj.input(0).getShape(), [1, 3, 32, 32]);
assert.deepStrictEqual(obj.input(0).shape, testModelFP32.inputShape);
assert.deepStrictEqual(
obj.input(0).getShape(),
testModelFP32.inputShape,
);
});
});
});
Expand All @@ -290,11 +292,11 @@ describe('ov basic tests.', () => {

before(() => {
tensor = Float32Array.from(
{ length: 3072 },
{ length: lengthFromShape(testModelFP32.inputShape) },
() => Math.random() + epsilon,
);
const core = new ov.Core();
const model = core.readModelSync(testXml);
const model = core.readModelSync(testModelFP32.xml);
const compiledModel = core.compileModelSync(model, 'CPU');
userStream = compiledModel.exportModelSync();
const inferRequest = compiledModel.createInferRequest();
Expand Down
13 changes: 8 additions & 5 deletions src/bindings/js/node/tests/unit/compiled_model.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@
const { addon: ov } = require('../..');
const assert = require('assert');
const { describe, it, before, beforeEach } = require('node:test');
const { testModels, getModelPath, isModelAvailable } = require('./utils.js');
const { testModels, isModelAvailable } = require('../utils.js');

describe('ov.CompiledModel tests', () => {
let testXml = null;
const { testModelFP32 } = testModels;
let core = null;
let compiledModel = null;

before(async () => {
await isModelAvailable(testModels.testModelFP32);
testXml = getModelPath().xml;
await isModelAvailable(testModelFP32);
core = new ov.Core();
});

beforeEach(() => {
const properties = {
AUTO_BATCH_TIMEOUT: '1',
};
compiledModel = core.compileModelSync(testXml, 'BATCH:CPU', properties);
compiledModel = core.compileModelSync(
testModelFP32.xml,
'BATCH:CPU',
properties
);
});

describe('getProperty()', () => {
Expand Down
9 changes: 5 additions & 4 deletions src/bindings/js/node/tests/unit/core.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
const { addon: ov } = require('../..');
const assert = require('assert');
const { describe, it, before, beforeEach } = require('node:test');
const { testModels, isModelAvailable, getModelPath } = require('./utils.js');
const { testModels, isModelAvailable } = require('../utils.js');

describe('ov.Core tests', () => {
const { testModelFP32 } = testModels;
let core = null;
before(async () => {
await isModelAvailable(testModels.testModelFP32);
await isModelAvailable(testModelFP32);
});

beforeEach(() => {
Expand Down Expand Up @@ -95,15 +96,15 @@ describe('ov.Core tests', () => {
});

it('Core.queryModel() with incorrect arguments should throw an error', () => {
const model = core.readModelSync(getModelPath().xml);
const model = core.readModelSync(testModelFP32.xml);
assert.throws(
() => core.queryModel(model, 'arg1', 'arg2').then(),
/'queryModel' method called with incorrect parameters./,
);
});

it('Core.queryModel() should have device in the result values', () => {
const model = core.readModelSync(getModelPath().xml);
const model = core.readModelSync(testModelFP32.xml);
const device = 'CPU';
const queryModel = core.queryModel(model, device);
assert(Object.values(queryModel).includes(device));
Expand Down
46 changes: 35 additions & 11 deletions src/bindings/js/node/tests/unit/infer_request.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,43 @@
const { addon: ov } = require('../..');
const assert = require('assert');
const { describe, it, before, beforeEach } = require('node:test');
const { testModels, isModelAvailable, getModelPath } = require('./utils.js');
const {
testModels,
isModelAvailable,
lengthFromShape,
} = require('../utils.js');

const epsilon = 0.5; // To avoid very small numbers
const testXml = getModelPath().xml;

describe('ov.InferRequest tests', () => {
const { testModelFP32 } = testModels;
let compiledModel = null;
let tensorData = null;
let tensor = null;
let resTensor = null;
let tensorLike = null;

before(async () => {
await isModelAvailable(testModels.testModelFP32);
await isModelAvailable(testModelFP32);

const core = new ov.Core();
const model = core.readModelSync(testXml);
const model = core.readModelSync(testModelFP32.xml);
compiledModel = core.compileModelSync(model, 'CPU');

tensorData = Float32Array.from(
{ length: 3072 },
{ length: lengthFromShape(testModelFP32.inputShape) },
() => Math.random() + epsilon,
);
tensor = new ov.Tensor(ov.element.f32, [1, 3, 32, 32], tensorData);
resTensor = new ov.Tensor(ov.element.f32, [1, 10], tensorData.slice(-10));
tensor = new ov.Tensor(
ov.element.f32,
testModelFP32.inputShape,
tensorData,
);
resTensor = new ov.Tensor(
ov.element.f32,
testModelFP32.outputShape,
tensorData.slice(-10),
);
tensorLike = [tensor, tensorData];
});

Expand All @@ -43,15 +55,21 @@ describe('ov.InferRequest tests', () => {
tensorLike.forEach((tl) => {
const result = inferRequest.infer({ data: tl });
assert.deepStrictEqual(Object.keys(result), ['fc_out']);
assert.deepStrictEqual(result['fc_out'].data.length, 10);
assert.deepStrictEqual(
result['fc_out'].data.length,
lengthFromShape(testModelFP32.outputShape)
);
});
});

it('Test infer(inputData: Tensor[]/TypedArray[])', () => {
tensorLike.forEach((tl) => {
const result = inferRequest.infer([tl]);
assert.deepStrictEqual(Object.keys(result), ['fc_out']);
assert.deepStrictEqual(result['fc_out'].data.length, 10);
assert.deepStrictEqual(
result['fc_out'].data.length,
lengthFromShape(testModelFP32.outputShape),
);
});
});

Expand Down Expand Up @@ -102,15 +120,21 @@ describe('ov.InferRequest tests', () => {
inferRequest.inferAsync({ data: tensor }).then((result) => {
assert.ok(result['fc_out'] instanceof ov.Tensor);
assert.deepStrictEqual(Object.keys(result), ['fc_out']);
assert.deepStrictEqual(result['fc_out'].data.length, 10);
assert.deepStrictEqual(
result['fc_out'].data.length,
lengthFromShape(testModelFP32.outputShape),
);
});
});

it('Test inferAsync(inputData: Tensor[])', () => {
inferRequest.inferAsync([tensor]).then((result) => {
assert.ok(result['fc_out'] instanceof ov.Tensor);
assert.deepStrictEqual(Object.keys(result), ['fc_out']);
assert.deepStrictEqual(result['fc_out'].data.length, 10);
assert.deepStrictEqual(
result['fc_out'].data.length,
lengthFromShape(testModelFP32.outputShape),
);
});
});

Expand Down
9 changes: 4 additions & 5 deletions src/bindings/js/node/tests/unit/model.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@
const { addon: ov } = require('../..');
const assert = require('assert');
const { describe, it, before, beforeEach } = require('node:test');
const { testModels, getModelPath, isModelAvailable } = require('./utils.js');
const { testModels, isModelAvailable } = require('../utils.js');

describe('ov.Model tests', () => {
let testXml = null;
const { testModelFP32 } = testModels;
let core = null;
let model = null;

before(async () => {
await isModelAvailable(testModels.testModelFP32);
testXml = getModelPath().xml;
await isModelAvailable(testModelFP32);
core = new ov.Core();
});

beforeEach(() => {
model = core.readModelSync(testXml);
model = core.readModelSync(testModelFP32.xml);
});

describe('Model.isDynamic()', () => {
Expand Down
9 changes: 4 additions & 5 deletions src/bindings/js/node/tests/unit/pre_post_processor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@
const { addon: ov } = require('../..');
const assert = require('assert');
const { describe, it, before, beforeEach } = require('node:test');
const { testModels, getModelPath, isModelAvailable } = require('./utils.js');
const { testModels, isModelAvailable } = require('../utils.js');

describe('ov.preprocess.PrePostProcessor tests', () => {
let testXml = null;
const { testModelFP32 } = testModels;
let core = null;
let model = null;

before(async () => {
await isModelAvailable(testModels.testModelFP32);
testXml = getModelPath().xml;
await isModelAvailable(testModelFP32);
core = new ov.Core();
});

beforeEach(() => {
model = core.readModelSync(testXml);
model = core.readModelSync(testModelFP32.xml);
});

describe('PrePostProcess', () => {
Expand Down
Loading

0 comments on commit d0bd6cd

Please sign in to comment.