How to use the @tensorflow-models/universal-sentence-encoder.loadTokenizer function in @tensorflow-models/universal-sentence-encoder

To help you get started, we’ve selected a few @tensorflow-models/universal-sentence-encoder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tensorflow / tfjs-models / toxicity / src / index.ts View on Github external
async loadTokenizer() {
    return use.loadTokenizer();
  }
github repetere / tensorscript / bundle / tensorscript.esm.js View on Github external
async train() {
    const promises = [];
    if (!model) promises.push(load());
    else promises.push(Promise.resolve(model));
    if (!tokenizer) promises.push(loadTokenizer());
    else promises.push(Promise.resolve(tokenizer));
    const USE = await Promise.all(promises);
    if (!model) model = USE[ 0 ];
    if (!tokenizer) tokenizer = USE[ 1 ];
    this.model = model;
    this.tokenizer = tokenizer;
    return this.model;
  }
  /**
github repetere / tensorscript / bundle / tensorscript.cjs.js View on Github external
async train() {
    const promises = [];
    if (!model) promises.push(UniversalSentenceEncoder.load());
    else promises.push(Promise.resolve(model));
    if (!tokenizer) promises.push(UniversalSentenceEncoder.loadTokenizer());
    else promises.push(Promise.resolve(tokenizer));
    const USE = await Promise.all(promises);
    if (!model) model = USE[ 0 ];
    if (!tokenizer) tokenizer = USE[ 1 ];
    this.model = model;
    this.tokenizer = tokenizer;
    return this.model;
  }
  /**

@tensorflow-models/universal-sentence-encoder

Universal Sentence Encoder lite in TensorFlow.js

Apache-2.0
Latest version published 3 years ago

Package Health Score

69 / 100
Full package analysis

Similar packages