Re-enable doctests for the quicktour (#15828)

* Re-enable doctests for the quicktour

* Re-enable doctests for task_summary (#15830)

* Remove &
This commit is contained in:
Sylvain Gugger
2022-02-25 17:46:38 +01:00
committed by GitHub
parent fd5b05eb81
commit 0118c4f6a8
5 changed files with 98 additions and 37 deletions

View File

@@ -122,7 +122,8 @@ is paraphrase: 90%
... print(f"{classes[i]}: {int(round(not_paraphrase_results[i] * 100))}%")
not paraphrase: 94%
is paraphrase: 6%
===PT-TF-SPLIT===
>>> # ===PT-TF-SPLIT===
>>> from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
>>> import tensorflow as tf
@@ -258,7 +259,8 @@ Question: What does 🤗 Transformers provide?
Answer: general - purpose architectures
Question: 🤗 Transformers provides interoperability between which frameworks?
Answer: tensorflow 2. 0 and pytorch
===PT-TF-SPLIT===
>>> # ===PT-TF-SPLIT===
>>> from transformers import AutoTokenizer, TFAutoModelForQuestionAnswering
>>> import tensorflow as tf
@@ -407,7 +409,8 @@ Distilled models are smaller than the models they mimic. Using them instead of t
Distilled models are smaller than the models they mimic. Using them instead of the large versions would help decrease our carbon footprint.
Distilled models are smaller than the models they mimic. Using them instead of the large versions would help offset our carbon footprint.
Distilled models are smaller than the models they mimic. Using them instead of the large versions would help improve our carbon footprint.
===PT-TF-SPLIT===
>>> # ===PT-TF-SPLIT===
>>> from transformers import TFAutoModelForMaskedLM, AutoTokenizer
>>> import tensorflow as tf
@@ -481,7 +484,8 @@ of tokens.
>>> resulting_string = tokenizer.decode(generated.tolist()[0])
>>> print(resulting_string)
Hugging Face is based in DUMBO, New York City, and ...
===PT-TF-SPLIT===
>>> # ===PT-TF-SPLIT===
>>> from transformers import TFAutoModelForCausalLM, AutoTokenizer, tf_top_k_top_p_filtering
>>> import tensorflow as tf
@@ -565,7 +569,8 @@ Below is an example of text generation using `XLNet` and its tokenizer, which in
>>> print(generated)
Today the weather is really nice and I am planning ...
===PT-TF-SPLIT===
>>> # ===PT-TF-SPLIT===
>>> from transformers import TFAutoModelForCausalLM, AutoTokenizer
>>> model = TFAutoModelForCausalLM.from_pretrained("xlnet-base-cased")
@@ -687,7 +692,7 @@ Here is an example of doing named entity recognition, using a model and a tokeni
>>> outputs = model(**inputs).logits
>>> predictions = torch.argmax(outputs, dim=2)
===PT-TF-SPLIT===
>>> # ===PT-TF-SPLIT===
>>> from transformers import TFAutoModelForTokenClassification, AutoTokenizer
>>> import tensorflow as tf
@@ -827,7 +832,8 @@ CNN / Daily Mail), it yields very good results.
<pad> prosecutors say the marriages were part of an immigration scam. if convicted, barrientos faces two criminal
counts of "offering a false instrument for filing in the first degree" she has been married 10 times, nine of them
between 1999 and 2002.</s>
===PT-TF-SPLIT===
>>> # ===PT-TF-SPLIT===
>>> from transformers import TFAutoModelForSeq2SeqLM, AutoTokenizer
>>> model = TFAutoModelForSeq2SeqLM.from_pretrained("t5-base")
@@ -890,7 +896,8 @@ Here is an example of doing translation using a model and a tokenizer. The proce
>>> print(tokenizer.decode(outputs[0]))
<pad> Hugging Face ist ein Technologieunternehmen mit Sitz in New York und Paris.</s>
===PT-TF-SPLIT===
>>> # ===PT-TF-SPLIT===
>>> from transformers import TFAutoModelForSeq2SeqLM, AutoTokenizer
>>> model = TFAutoModelForSeq2SeqLM.from_pretrained("t5-base")