3.0.0 (2020-07-02)
This version introduces full support for any DistilBERT/BERT/RoBERTa based models from the Hugging Face model hub. It also simplifies the model instantiation by introducing a single initModel
factory method (and its equivalent initTokenizer
if needed).
- Nodejs v12 is now the minimum required version if using SavedModel format: for this model format, the library now makes use of a worker thread internally to provide full non-blocking processing of prediction requests, a feature that is only supported fully starting in version 12.
- The model-specific instantiation methods are removed and replaced by a single
initModel
method paired with aruntime
field which can either betfjs
,saved_model
orremote
. - When passing a tokenizer to
QAClient.fromOptions
, the tokenizer now needs to extends the abstractTokenizer
class, which itself is a wrapper around 🤗Tokenizers. - The
cased
option is moved from the model instantiation to theQAClient.fromOptions
method.
- Added compatibility with BERT/RoBERTa based models
- 15 new additional models available thanks to the Hugging Face model hub and the NLP community
- The model doesn't need to be downloaded through the CLI before running the code for the first time: if it's not present in the default (or specified) model directory, it will be automatically downloaded at runtime during initialization, along with vocabulary / tokenizer files.
- 🤗Tokenizers now requires version
0.7.0
.
Before:
const model = await SavedModel.fromOptions({ path: "distilbert-uncased", cased: false });
const qaClient = await QAClient.fromOptions({ model });
After:
const model = await initModel({ name: "distilbert-uncased" });
const qaClient = await QAClient.fromOptions({ model, cased: false });
// `cased` can be omitted: it will be based on the tokenizer configuration if possible, otherwise inferred from the model name
⚠️ Warning: due to a bug in TFJS, the use of@tensorflow/tfjs-node
to load or execute SavedModel models independently from the library is not recommended for now, since it could overwrite the TF backend used internally by the library. In the case where you would have to do so, make sure to require bothquestion-answering
and@tensorflow/tfjs-node
in your code before making any use of either of them.
Before:
const model = await TFJS.fromOptions({ path: "distilbert-uncased", cased: false });
const qaClient = await QAClient.fromOptions({ model });
After:
const model = await initModel({ name: "distilbert-uncased", runtime: RuntimeType.TFJS });
const qaClient = await QAClient.fromOptions({ model }); // `cased` can be omitted (see SavedModel migration)
Before:
const model = await RemoteModel.fromOptions({ path: "http://localhost:8501/v1/models/cased" cased: false });
const qaClient = await QAClient.fromOptions({ model });
After:
const model = await initModel({
name: "distilbert-uncased",
path: "http://localhost:8501/v1/models/cased",
runtime: RuntimeType.Remote
});
const qaClient = await QAClient.fromOptions({ model }); // `cased` can be omitted (see SavedModel migration)
2.0.0 (2020-03-10)
This version introduces support for models in TFJS format.
- 3 new classes implementing an abstract
Model
are introduced:SavedModel
,TFJSModel
andRemoteModel
. They can be instanciated using a.fromOptions
method. - The
model
field of theQAClient.fromOptions
methods now expects aModel
(sub)class instance.
- Upgrade 🤗Tokenizers to
0.6.0
Before:
const qaClient = await QAClient.fromOptions({
model: { path: "distilbert-uncased", cased: false }
});
After:
const model = await SavedModel.fromOptions({ path: "distilbert-uncased", cased: false });
const qaClient = await QAClient.fromOptions({ model });
Before:
const qaClient = await QAClient.fromOptions({
model: { path: "distilbert-uncased", cased: false, remote: true }
});
After:
const model = await RemoteModel.fromOptions({ path: "http://localhost:8501/v1/models/cased", cased: false });
const qaClient = await QAClient.fromOptions({ model });