Run this model with HF Jobs
Run deepset/gbert-base-germandpr-ctx_encoder on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/deepset/gbert-base-germandpr-ctx_encoder. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/deepset/gbert-base-germandpr-ctx_encoder on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use deepset/gbert-base-germandpr-ctx_encoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use deepset/gbert-base-germandpr-ctx_encoder with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, DPRContextEncoder tokenizer = AutoTokenizer.from_pretrained("deepset/gbert-base-germandpr-ctx_encoder") model = DPRContextEncoder.from_pretrained("deepset/gbert-base-germandpr-ctx_encoder", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Bogdan Kostić commited on
Commit ·
acb3364
1
Parent(s): c37f6a2
Add context encoder model
Browse filesFiles changed (6)
- README.mdAdded+80
- config.jsonAdded+27
- pytorch_model.binAdded+3
- special_tokens_map.jsonAdded+1
- tokenizer_config.jsonAdded+1
- vocab.txtAdded
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980---language: delicense: mitthumbnail: https://thumb.tildacdn.com/tild3433-3637-4830-a533-353833613061/-/resize/720x/-/format/webp/germanquad.jpgtags:- exbert---

## Overview**Language model:** gbert-base-germandpr **Language:** German **Training data:** GermanDPR train set (~ 56MB) **Eval data:** GermanDPR test set (~ 6MB) **Infrastructure**: 4x V100 GPU **Published**: Apr 26th, 2021
## Details- We trained a dense passage retrieval model with two gbert-base models as encoders of questions and passages.- The dataset is GermanDPR, a new, German language dataset, which we hand-annotated and published [online](https://deepset.ai/germanquad).- It comprises 9275 question/answer pairs in the training set and 1025 pairs in the test set.For each pair, there are one positive context and three hard negative contexts.- As the basis of the training data, we used our hand-annotated GermanQuAD dataset as positive samples and generated hard negative samples from the latest German Wikipedia dump (6GB of raw txt files).- The data dump was cleaned with tailored scripts, leading to 2.8 million indexed passages from German Wikipedia.
See https://deepset.ai/germanquad for more details and dataset download.
## Hyperparameters```batch_size = 40n_epochs = 20num_training_steps = 4640num_warmup_steps = 460max_seq_len = 32 tokens for question encoder and 300 tokens for passage encoderlearning_rate = 1e-6lr_schedule = LinearWarmupembeds_dropout_prob = 0.1num_hard_negatives = 2```## PerformanceDuring training, we monitored the in-batch average rank and the loss and evaluated different batch sizes, numbers of epochs, and number of hard negatives on a dev set split from the train set.The dev split contained 1030 question/answer pairs.Even without thorough hyperparameter tuning, we observed quite stable learning. Multiple restarts with different seeds produced quite similar results.Note that the in-batch average rank is influenced by settings for batch size and number of hard negatives. A smaller number of hard negatives makes the task easier.After fixing the hyperparameters we trained the model on the full GermanDPR train set. We further evaluated the retrieval performance of the trained model on the full German Wikipedia with the GermanDPR test set as labels. To this end, we converted the GermanDPR test set to SQuAD format. The DPR model drastically outperforms the BM25 baseline with regard to recall@k.
## Usage### In haystackYou can load the model in [haystack](https://github.com/deepset-ai/haystack/) as a retriever for doing QA at scale:```pythonretriever = DensePassageRetriever( document_store=document_store, query_embedding_model="deepset/gbert-base-germandpr-question_encoder" passage_embedding_model="deepset/gbert-base-germandpr-ctx_encoder")```
## Authors- Timo Möller: `timo.moeller [at] deepset.ai`- Julian Risch: `julian.risch [at] deepset.ai`- Malte Pietsch: `malte.pietsch [at] deepset.ai`## About usWe bring NLP to the industry via open source! Our focus: Industry specific language models & large scale QA systems. Some of our work: - [German BERT (aka "bert-base-german-cased")](https://deepset.ai/german-bert)- [GermanQuAD and GermanDPR datasets and models (aka "gelectra-base-germanquad", "gbert-base-germandpr")](https://deepset.ai/germanquad)- [FARM](https://github.com/deepset-ai/FARM)- [Haystack](https://github.com/deepset-ai/haystack/)
Get in touch:[Twitter](https://twitter.com/deepset_ai) | [LinkedIn](https://www.linkedin.com/company/deepset-ai/) | [Website](https://deepset.ai)
By the way: [we're hiring!](https://apply.workable.com/deepset/) 123456789101112131415161718192021222324252627{ "_name_or_path": "../../gbert-base-germandpr/lm2/language_model.bin", "architectures": [ "DPRContextEncoder" ], "attention_probs_dropout_prob": 0.1, "gradient_checkpointing": false, "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 768, "initializer_range": 0.02, "intermediate_size": 3072, "language": "english", "layer_norm_eps": 1e-12, "max_position_embeddings": 512, "model_type": "dpr", "name": "DPRContextEncoder", "num_attention_heads": 12, "num_hidden_layers": 12, "pad_token_id": 0, "position_embedding_type": "absolute", "projection_dim": 0, "revision": null, "transformers_version": "4.5.0", "type_vocab_size": 2, "vocab_size": 31102}123version https://git-lfs.github.com/spec/v1oid sha256:81027779cf0b4e3fea7843b6513ba80b1220346f43ea6ce783292734d5f4496csize 4398044791{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}1{"do_lower_case": false, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": false, "max_len": 512, "special_tokens_map_file": null, "name_or_path": "deepset/gbert-base", "do_basic_tokenize": true, "never_split": null}README.mdAdded+80
config.jsonAdded+27
pytorch_model.binAdded+3
special_tokens_map.jsonAdded+1
tokenizer_config.jsonAdded+1
vocab.txtAdded