orchestrator-core
Advanced tools
Comparing version 4.11.0-dev.20201008.cb67719 to 4.11.0-dev.20201019.99b4b50
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
function buf2hex(buffer) { // buffer is an ArrayBuffer | ||
@@ -9,3 +8,2 @@ return Array.prototype.map.call(new Uint8Array(buffer), x => ('00' + x.toString(16)).slice(-2)).join(' '); | ||
const oc = require('./orchestrator-core.node'); | ||
@@ -15,13 +13,13 @@ const util = require('util') | ||
async function addExamples() { | ||
console.log('Create Orchestrator..') | ||
console.log('---- Create Orchestrator..') | ||
const orchestrator = new oc.Orchestrator(); | ||
console.log('Loading NLR..') | ||
const load_result = orchestrator.load('../dep/model'); // Return boolean, separate load. | ||
console.log('---- Loading NLR..') | ||
const load_result = orchestrator.load('../dep/model/roberta'); // Return boolean, separate load. | ||
if (load_result === false) | ||
{ | ||
console.log('Loading NLR failed!!'); | ||
console.log('ERROR: Loading NLR failed!!'); | ||
} | ||
console.log('Creating labeler..'); | ||
console.log('---- Creating labeler..'); | ||
let labeler = orchestrator.createLabelResolver(); | ||
@@ -35,3 +33,3 @@ | ||
{ | ||
console.log("Set runtime params successfully!") | ||
console.log("SUCCESS: set runtime params successfully!") | ||
} | ||
@@ -55,10 +53,10 @@ else | ||
console.log('Adding example COMPLEX..'); | ||
console.log('---- Adding example COMPLEX..'); | ||
var val = labeler.addExample(example); | ||
if (val == true) | ||
{ | ||
console.log('Added example!'); | ||
console.log('SUCCESS: added example - 0!'); | ||
} | ||
console.log('Adding Labels array.') | ||
console.log('---- Adding Labels array.') | ||
const example_multi_single = { | ||
@@ -78,3 +76,3 @@ text: 'another book a flight to miami.', | ||
{ | ||
console.log('Added example2!'); | ||
console.log('SUCCESS: added example - 1!'); | ||
} | ||
@@ -104,3 +102,3 @@ const example_multi_label = { | ||
{ | ||
console.log('Added example2!'); | ||
console.log('SUCCESS: added example - 2!'); | ||
} | ||
@@ -114,3 +112,3 @@ const example2 = { | ||
{ | ||
console.log('Added example2!'); | ||
console.log('SUCCESS: added example - 3!'); | ||
} | ||
@@ -124,13 +122,22 @@ const example3 = { | ||
{ | ||
console.log('Added example3!'); | ||
console.log('SUCCESS: added example3 - 4!'); | ||
} | ||
// | ||
// Score | ||
// | ||
console.log('---- Scoring') | ||
var results = labeler.score("hey"); | ||
console.log(util.inspect(results, true, null, true /* enable colors */)); | ||
// | ||
// Score | ||
// | ||
console.log('---- Creating Snapshot') | ||
var snapshot = labeler.createSnapshot(); | ||
console.log('Created snapshot!'); | ||
console.log('Going to create labeler #2'); | ||
console.log('SUCCESS: created snapshot!'); | ||
console.log('---- Going to create labeler #2'); | ||
let labeler2 = orchestrator.createLabelResolver(snapshot); | ||
console.log('Created Labeler #2.'); | ||
console.log('SUCCESS: created Labeler #2.'); | ||
@@ -140,3 +147,3 @@ // | ||
// | ||
console.log('Getting examples') | ||
console.log('---- Getting examples') | ||
let examples = labeler2.getExamples(); | ||
@@ -147,2 +154,3 @@ console.log(util.inspect(examples, true, null, true /* enable colors */)); | ||
// | ||
console.log('---- Removing examples') | ||
labeler2.removeExample(example3); | ||
@@ -155,17 +163,23 @@ examples = labeler2.getExamples(); | ||
// | ||
console.log('---- Get Labels'); | ||
var labels = labeler2.getLabels(); | ||
console.log(util.inspect(labels, true, null, true /* enable colors */)); | ||
// | ||
// Get Intent Labels | ||
// | ||
console.log('---- Get Intent Labels'); | ||
var labels = labeler2.getLabels(1); | ||
console.log(util.inspect(labels, true, null, true /* enable colors */)); | ||
} | ||
addExamples(); | ||
const readline = require('readline'); | ||
const rl = readline.createInterface({ input: process.stdin, output: process.stdout}); | ||
rl.question('>', (answer) => { | ||
console.log('Completed embedding:') | ||
console.log(buf2hex(embedding)) | ||
rl.close(); | ||
}); | ||
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== const readline = require('readline'); | ||
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== const rl = readline.createInterface({ input: process.stdin, output: process.stdout}); | ||
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== | ||
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== rl.question('>', (answer) => { | ||
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== console.log('Completed embedding:') | ||
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== console.log(buf2hex(embedding)) | ||
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== rl.close(); | ||
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== }); |
@@ -5,3 +5,3 @@ { | ||
"description": "Orchestrator for Node.js", | ||
"version": "4.11.0-dev.20201008.cb67719", | ||
"version": "4.11.0-dev.20201019.99b4b50", | ||
"license": "MIT", | ||
@@ -27,3 +27,4 @@ "keywords": [ | ||
"node-gyp": "7.0.0", | ||
"node-pre-gyp": "0.15.0" | ||
"node-pre-gyp": "0.15.0", | ||
"onnxruntime": "1.4.0" | ||
}, | ||
@@ -45,3 +46,3 @@ "binary": { | ||
"test": "nyc mocha tests/", | ||
"start": "cross-env OC_MODEL_DIR='../dep/model/' node oc_app.js", | ||
"start": "cross-env OC_MODEL_DIR='../dep/model/roberta/' node oc_app.js", | ||
"build:dev": "node-gyp -j 16 build --debug", | ||
@@ -48,0 +49,0 @@ "build": "node-gyp -j 16 build", |
@@ -188,2 +188,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
assert.ok(examples.length === 601, `#examples is ${examples.length}`); | ||
const labels = labelResolver.getLabels(); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: labels=${labels}`); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: labels.length=${labels.length}`); | ||
assert.ok(labels.length === 15, `#labels is ${labels.length}`); | ||
const labelsIntent = labelResolver.getLabels(1); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: labelsIntent=${labelsIntent}`); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: labelsIntent.length=${labelsIntent.length}`); | ||
assert.ok(labelsIntent.length === 15, `#labelsIntent is ${labelsIntent.length}`); | ||
}); | ||
@@ -190,0 +198,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
340898
540
5
+ Addedonnxruntime@1.4.0
+ Addedbase64-js@1.5.1(transitive)
+ Addedbl@4.1.0(transitive)
+ Addedbuffer@5.7.1(transitive)
+ Addeddecompress-response@4.2.1(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedexpand-template@2.0.3(transitive)
+ Addedfs-constants@1.0.0(transitive)
+ Addedgithub-from-package@0.0.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedmimic-response@2.1.0(transitive)
+ Addedmkdirp-classic@0.5.3(transitive)
+ Addednapi-build-utils@1.0.2(transitive)
+ Addednode-abi@2.30.1(transitive)
+ Addednoop-logger@0.1.1(transitive)
+ Addedonnxruntime@1.4.0(transitive)
+ Addedprebuild-install@5.3.6(transitive)
+ Addedpump@3.0.2(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsimple-concat@1.0.1(transitive)
+ Addedsimple-get@3.1.1(transitive)
+ Addedtar-fs@2.1.1(transitive)
+ Addedtar-stream@2.2.0(transitive)
+ Addedwhich-pm-runs@1.1.0(transitive)