From 7df12d7bf8fa14e0daf39ad9efad6a47e94b1cda Mon Sep 17 00:00:00 2001 From: Manuel Romero Date: Thu, 20 Feb 2020 18:30:54 +0100 Subject: [PATCH] Update README.md - I added an example using the model with pipelines to show that we have set```{"use_fast": False}``` in the tokenizer. - I added a Colab to play with the model and pipelines - I added a Colab to discover Huggingface pipelines at the end of the document --- .../README.md | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/model_cards/mrm8488/distill-bert-base-spanish-wwm-cased-finetuned-spa-squad2-es/README.md b/model_cards/mrm8488/distill-bert-base-spanish-wwm-cased-finetuned-spa-squad2-es/README.md index 001d1bdd13..09a8894637 100644 --- a/model_cards/mrm8488/distill-bert-base-spanish-wwm-cased-finetuned-spa-squad2-es/README.md +++ b/model_cards/mrm8488/distill-bert-base-spanish-wwm-cased-finetuned-spa-squad2-es/README.md @@ -89,7 +89,37 @@ The model was trained on a Tesla P100 GPU and 25GB of RAM with the following com So, yes, this version is even more accurate. -### Model in action (in a Colab Notebook) +### Model in action + +Fast usage with **pipelines**: + +```python +from transformers import * + +# Important!: By now the QA pipeline is not compatible with fast tokenizer, but they are working on it. So that pass the object to the tokenizer {"use_fast": False} as in the following example: + +nlp = pipeline( + 'question-answering', + model='mrm8488/distill-bert-base-spanish-wwm-cased-finetuned-spa-squad2-es', + tokenizer=( + 'mrm8488/distill-bert-base-spanish-wwm-cased-finetuned-spa-squad2-es', + {"use_fast": False} + ) +) + +nlp( + { + 'question': '¿Para qué lenguaje está trabajando?', + 'context': 'Manuel Romero está colaborando activamente con huggingface/transformers ' + + 'para traer el poder de las últimas técnicas de procesamiento de lenguaje natural al idioma español' + } +) +# Output: {'answer': 'español', 'end': 169, 'score': 0.67530957344621, 'start': 163} +``` + +Play with this model and ```pipelines``` in a Colab: + +Open In Colab
@@ -100,13 +130,12 @@ So, yes, this version is even more accurate. 2. Run predictions: ![Run the model](https://media.giphy.com/media/WT453aptcbCP7hxWTZ/giphy.gif) - -3. Using **Pipelines** - -![qa-pipelines](https://media.giphy.com/media/L4YiWhinC3P1GF31t0/giphy.gif) -
+More about ``` Huggingface pipelines```? check this Colab out: + +Open In Colab + > Created by [Manuel Romero/@mrm8488](https://twitter.com/mrm8488) > Made with in Spain