Views
No views yet
bert-base-multilingual-cased. It is the same teacher used for distilbert-base-multilingual-cased AKA DistilmBERT (on average is twice as fast as mBERT-base).| Dataset | # Q&A |
|---|---|
| SQuAD2.0 Train | 130 K |
| SQuAD2.0-es-v2.0 | 111 K |
| SQuAD2.0 Dev | 12 K |
| SQuAD-es-v2.0-small Dev | 69 K |
1!export SQUAD_DIR=/path/to/squad-v2_spanish \
2&& python transformers/examples/distillation/run_squad_w_distillation.py \
3 --model_type bert \
4 --model_name_or_path dccuchile/bert-base-spanish-wwm-cased \
5 --teacher_type bert \
6 --teacher_name_or_path bert-base-multilingual-cased \
7 --do_train \
8 --do_eval \
9 --do_lower_case \
10 --train_file $SQUAD_DIR/train-v2.json \
11 --predict_file $SQUAD_DIR/dev-v2.json \
12 --per_gpu_train_batch_size 12 \
13 --learning_rate 3e-5 \
14 --num_train_epochs 5.0 \
15 --max_seq_length 384 \
16 --doc_stride 128 \
17 --output_dir /content/model_output \
18 --save_steps 5000 \
19 --threads 4 \
20 --version_2_with_negative1from transformers import *
2
3# 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:
4
5nlp = pipeline(
6 'question-answering',
7 model='mrm8488/distill-bert-base-spanish-wwm-cased-finetuned-spa-squad2-es',
8 tokenizer=(
9 'mrm8488/distill-bert-base-spanish-wwm-cased-finetuned-spa-squad2-es',
10 {"use_fast": False}
11 )
12)
13
14nlp(
15 {
16 'question': '¿Para qué lenguaje está trabajando?',
17 'context': 'Manuel Romero está colaborando activamente con huggingface/transformers ' +
18 'para traer el poder de las últimas técnicas de procesamiento de lenguaje natural al idioma español'
19 }
20)
21# Output: {'answer': 'español', 'end': 169, 'score': 0.67530957344621, 'start': 163}pipelines in a Colab:

Huggingface pipelines? check this Colab out:Created by Manuel Romero/@mrm8488
Made with ♥ in Spain