Haystack v1.8.0 adds batch pipeline eval, early stopping for training, SQL-free PineconeDocumentStore, and FAISS support in OpenSearch.
$ git clone --branch v1.8.0 https://github.com/deepset-ai/haystack.git # already have the repo? check out this version: $ git checkout v1.8.0
from haystack.nodes import FARMReader
from haystack.utils.early_stopping import EarlyStopping
reader = FARMReader(model_name_or_path="deepset/roberta-base-squad2-distilled")
reader.train(
data_dir="data/squad20",
train_filename="dev-v2.0.json",
early_stopping=EarlyStopping(min_delta=0.001),
use_gpu=True,
n_epochs=8,
save_dir="my_model"
) from haystack.document_stores import OpenSearchDocumentStore document_store = OpenSearchDocumentStore(knn_engine="faiss")
- ›Adds pipeline.eval_batch() method to
ExtractiveQAPipelinefor GPU-accelerated batch evaluation over large datasets, reducing evaluation run time. - ›Adds
EarlyStoppingclass (importable fromhaystack.utils.early_stopping) withmin_deltaparameter for FARMReader.train() andDensePassageRetrievertraining; monitorsloss,EM,f1,top_n_accuracy(FARMReader) orloss,acc,f1,average_rank(DensePassageRetriever). - ›Adds
knn_engineparameter toOpenSearchDocumentStoreto select betweennmslibandfaissapproximate k-NN libraries; falls back to exact vector calculation if the loaded index was built with a different engine. - ›
PineconeDocumentStoreno longer requires a local SQL database — initialization now only needs a Pinecone API key. - ›Adds exact list matching support for field filters in
ElasticsearchDocumentStore.
+1 moreshow less
- ›Adds progress bar to upload_files() in the deepset Cloud client.
2 more releases in this issue · 2022-08-15 → 2022-08-26
Haystack v1.7.1 lets you specify a configurable list of models to cache instead of a single hardcoded one.
$ git clone --branch v1.7.1 https://github.com/deepset-ai/haystack.git # already have the repo? check out this version: $ git checkout v1.7.1
- ›Supports passing a configurable list of models to cache, replacing the previously hardcoded single-model approach.
Haystack v1.7 adds OpenAI GPT-3 generation, zero-shot query classification, page-number metadata, gradient accumulation, and expanded Ray Serve support.
$ git clone --branch v1.7.0 https://github.com/deepset-ai/haystack.git # already have the repo? check out this version: $ git checkout v1.7.0
from haystack.nodes import TransformersQueryClassifier
classifier = TransformersQueryClassifier(
model_name_or_path="typeform/distilbert-base-uncased-mnli",
use_gpu=True,
task="zero-shot-classification",
labels=["music", "cinema", "food"],
)
result = classifier.run(query="Who directed Pulp Fiction?")
print(result) pipelines:
- name: ray_query_pipeline
nodes:
- name: EmbeddingRetriever
replicas: 2
inputs: [ Query ]
serve_deployment_kwargs:
num_replicas: 2
version: Twenty
ray_actor_options:
num_gpus: 0.25
num_cpus: 0.5
max_concurrent_queries: 17
- name: Reader
inputs: [ EmbeddingRetriever ] - ›Adds
OpenAIAnswerGeneratornode withapi_key,max_tokens, andtemperatureparameters for GPT-3-powered generative QA. - ›Adds
task='zero-shot-classification'andlabelsparameters toTransformersQueryClassifier, enabling multi-class zero-shot query routing with any MNLI-style model. - ›Adds
add_page_number=Trueparameter toParsrConverter,AzureConverter, andPreProcessor, which populates a'page'meta field on each document chunk. - ›Adds
grad_acc_stepsparameter to FARMReader.train() for gradient accumulation, enabling large-model fine-tuning on memory-constrained GPUs. - ›Adds
serve_deployment_kwargskey to Pipeline YAML node definitions, supportingnum_replicas,version,ray_actor_options(num_gpus,num_cpus), andmax_concurrent_queriesfor Ray Serve deployments.
+5 moreshow less
- ›Adds
tokenizer_model_folderparameter toPreProcessorto support custom domain-specific sentence tokenizer models. - ›Adds update_document_meta() method to
InMemoryDocumentStore, aligning its interface with other document stores. - ›Adds BM25 retrieval support to the Weaviate document store.
- ›Enables
JoinDocumentsnode to handle documents withscore=None. - ›Nearly 2x performance gain for Electra reader models by eliminating a double forward-pass in the language modeling module.
- !Adding
update_document_metatoInMemoryDocumentStoreintroduces an interface change that may affect subclasses or code relying on the previousBaseDocumentStoremethod signatures. - !BM25 support in the Weaviate document store changes Weaviate integration behavior in a way flagged as breaking.
- !Extending the Ray Serve integration to allow
serve_deployment_kwargsattributes in Pipeline YAMLs changes the YAML schema in a breaking way. - !
MultiLabelIDs are now consistent across Python interpreters, changing previously generated ID values.