From c403441339587028cd7e773cec6ece008ccf63d8 Mon Sep 17 00:00:00 2001 From: Fanli Lin Date: Thu, 12 Sep 2024 00:56:40 +0800 Subject: [PATCH] [docs] add the missing huggingface hub username (#33431) * add username * update username * add username --- docs/source/en/tasks/multiple_choice.md | 8 ++++---- docs/source/en/tasks/summarization.md | 10 +++++----- docs/source/en/tasks/translation.md | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/source/en/tasks/multiple_choice.md b/docs/source/en/tasks/multiple_choice.md index 4adcad5232..fc63c35425 100644 --- a/docs/source/en/tasks/multiple_choice.md +++ b/docs/source/en/tasks/multiple_choice.md @@ -399,7 +399,7 @@ Tokenize each prompt and candidate answer pair and return PyTorch tensors. You s ```py >>> from transformers import AutoTokenizer ->>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_swag_model") +>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_swag_model") >>> inputs = tokenizer([[prompt, candidate1], [prompt, candidate2]], return_tensors="pt", padding=True) >>> labels = torch.tensor(0).unsqueeze(0) ``` @@ -409,7 +409,7 @@ Pass your inputs and labels to the model and return the `logits`: ```py >>> from transformers import AutoModelForMultipleChoice ->>> model = AutoModelForMultipleChoice.from_pretrained("my_awesome_swag_model") +>>> model = AutoModelForMultipleChoice.from_pretrained("username/my_awesome_swag_model") >>> outputs = model(**{k: v.unsqueeze(0) for k, v in inputs.items()}, labels=labels) >>> logits = outputs.logits ``` @@ -428,7 +428,7 @@ Tokenize each prompt and candidate answer pair and return TensorFlow tensors: ```py >>> from transformers import AutoTokenizer ->>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_swag_model") +>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_swag_model") >>> inputs = tokenizer([[prompt, candidate1], [prompt, candidate2]], return_tensors="tf", padding=True) ``` @@ -437,7 +437,7 @@ Pass your inputs to the model and return the `logits`: ```py >>> from transformers import TFAutoModelForMultipleChoice ->>> model = TFAutoModelForMultipleChoice.from_pretrained("my_awesome_swag_model") +>>> model = TFAutoModelForMultipleChoice.from_pretrained("username/my_awesome_swag_model") >>> inputs = {k: tf.expand_dims(v, 0) for k, v in inputs.items()} >>> outputs = model(inputs) >>> logits = outputs.logits diff --git a/docs/source/en/tasks/summarization.md b/docs/source/en/tasks/summarization.md index 92542a774a..76e750ed3b 100644 --- a/docs/source/en/tasks/summarization.md +++ b/docs/source/en/tasks/summarization.md @@ -336,7 +336,7 @@ The simplest way to try out your finetuned model for inference is to use it in a ```py >>> from transformers import pipeline ->>> summarizer = pipeline("summarization", model="stevhliu/my_awesome_billsum_model") +>>> summarizer = pipeline("summarization", model="username/my_awesome_billsum_model") >>> summarizer(text) [{"summary_text": "The Inflation Reduction Act lowers prescription drug costs, health care costs, and energy costs. It's the most aggressive action on tackling the climate crisis in American history, which will lift up American workers and create good-paying, union jobs across the country."}] ``` @@ -351,7 +351,7 @@ Tokenize the text and return the `input_ids` as PyTorch tensors: ```py >>> from transformers import AutoTokenizer ->>> tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_billsum_model") +>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_billsum_model") >>> inputs = tokenizer(text, return_tensors="pt").input_ids ``` @@ -360,7 +360,7 @@ Use the [`~generation.GenerationMixin.generate`] method to create the summarizat ```py >>> from transformers import AutoModelForSeq2SeqLM ->>> model = AutoModelForSeq2SeqLM.from_pretrained("stevhliu/my_awesome_billsum_model") +>>> model = AutoModelForSeq2SeqLM.from_pretrained("username/my_awesome_billsum_model") >>> outputs = model.generate(inputs, max_new_tokens=100, do_sample=False) ``` @@ -377,7 +377,7 @@ Tokenize the text and return the `input_ids` as TensorFlow tensors: ```py >>> from transformers import AutoTokenizer ->>> tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_billsum_model") +>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_billsum_model") >>> inputs = tokenizer(text, return_tensors="tf").input_ids ``` @@ -386,7 +386,7 @@ Use the [`~transformers.generation_tf_utils.TFGenerationMixin.generate`] method ```py >>> from transformers import TFAutoModelForSeq2SeqLM ->>> model = TFAutoModelForSeq2SeqLM.from_pretrained("stevhliu/my_awesome_billsum_model") +>>> model = TFAutoModelForSeq2SeqLM.from_pretrained("username/my_awesome_billsum_model") >>> outputs = model.generate(inputs, max_new_tokens=100, do_sample=False) ``` diff --git a/docs/source/en/tasks/translation.md b/docs/source/en/tasks/translation.md index bcbad0ba05..1028e4c6cf 100644 --- a/docs/source/en/tasks/translation.md +++ b/docs/source/en/tasks/translation.md @@ -346,7 +346,7 @@ The simplest way to try out your finetuned model for inference is to use it in a # Change `xx` to the language of the input and `yy` to the language of the desired output. # Examples: "en" for English, "fr" for French, "de" for German, "es" for Spanish, "zh" for Chinese, etc; translation_en_to_fr translates English to French # You can view all the lists of languages here - https://huggingface.co/languages ->>> translator = pipeline("translation_xx_to_yy", model="my_awesome_opus_books_model") +>>> translator = pipeline("translation_xx_to_yy", model="username/my_awesome_opus_books_model") >>> translator(text) [{'translation_text': 'Legumes partagent des ressources avec des bactéries azotantes.'}] ``` @@ -360,7 +360,7 @@ Tokenize the text and return the `input_ids` as PyTorch tensors: ```py >>> from transformers import AutoTokenizer ->>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_opus_books_model") +>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_opus_books_model") >>> inputs = tokenizer(text, return_tensors="pt").input_ids ``` @@ -369,7 +369,7 @@ Use the [`~generation.GenerationMixin.generate`] method to create the translatio ```py >>> from transformers import AutoModelForSeq2SeqLM ->>> model = AutoModelForSeq2SeqLM.from_pretrained("my_awesome_opus_books_model") +>>> model = AutoModelForSeq2SeqLM.from_pretrained("username/my_awesome_opus_books_model") >>> outputs = model.generate(inputs, max_new_tokens=40, do_sample=True, top_k=30, top_p=0.95) ``` @@ -386,7 +386,7 @@ Tokenize the text and return the `input_ids` as TensorFlow tensors: ```py >>> from transformers import AutoTokenizer ->>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_opus_books_model") +>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_opus_books_model") >>> inputs = tokenizer(text, return_tensors="tf").input_ids ``` @@ -395,7 +395,7 @@ Use the [`~transformers.generation_tf_utils.TFGenerationMixin.generate`] method ```py >>> from transformers import TFAutoModelForSeq2SeqLM ->>> model = TFAutoModelForSeq2SeqLM.from_pretrained("my_awesome_opus_books_model") +>>> model = TFAutoModelForSeq2SeqLM.from_pretrained("username/my_awesome_opus_books_model") >>> outputs = model.generate(inputs, max_new_tokens=40, do_sample=True, top_k=30, top_p=0.95) ```