mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-01 18:51:14 +06:00
[model_cards] Fix tiny typos
This commit is contained in:
parent
99407f9d1e
commit
3242e4d942
@ -625,7 +625,7 @@ Breaking change in the `from_pretrained()` method:
|
|||||||
|
|
||||||
1. Models are now set in evaluation mode by default when instantiated with the `from_pretrained()` method. To train them, don't forget to set them back in training mode (`model.train()`) to activate the dropout modules.
|
1. Models are now set in evaluation mode by default when instantiated with the `from_pretrained()` method. To train them, don't forget to set them back in training mode (`model.train()`) to activate the dropout modules.
|
||||||
|
|
||||||
2. The additional `*input` and `**kwargs` arguments supplied to the `from_pretrained()` method used to be directly passed to the underlying model's class `__init__()` method. They are now used to update the model configuration attribute instead, which can break derived model classes built based on the previous `BertForSequenceClassification` examples. We are working on a way to mitigate this breaking change in [#866](https://github.com/huggingface/transformers/pull/866) by forwarding the the model's `__init__()` method (i) the provided positional arguments and (ii) the keyword arguments which do not match any configuration class attributes.
|
2. The additional `*input` and `**kwargs` arguments supplied to the `from_pretrained()` method used to be directly passed to the underlying model's class `__init__()` method. They are now used to update the model configuration attribute instead, which can break derived model classes built based on the previous `BertForSequenceClassification` examples. We are working on a way to mitigate this breaking change in [#866](https://github.com/huggingface/transformers/pull/866) by forwarding the model's `__init__()` method (i) the provided positional arguments and (ii) the keyword arguments which do not match any configuration class attributes.
|
||||||
|
|
||||||
Also, while not a breaking change, the serialization methods have been standardized and you probably should switch to the new method `save_pretrained(save_directory)` if you were using any other serialization method before.
|
Also, while not a breaking change, the serialization methods have been standardized and you probably should switch to the new method `save_pretrained(save_directory)` if you were using any other serialization method before.
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ classifier = pipeline("zero-shot-classification",
|
|||||||
model="joeddav/xlm-roberta-large-xnli")
|
model="joeddav/xlm-roberta-large-xnli")
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then classify in any of the above langauges. You can even pass the labels in one language and the sequence to
|
You can then classify in any of the above languages. You can even pass the labels in one language and the sequence to
|
||||||
classify in another:
|
classify in another:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@ -112,6 +112,6 @@ prob_label_is_true = probs[:,1]
|
|||||||
This model was pre-trained on set of 100 languages, as described in
|
This model was pre-trained on set of 100 languages, as described in
|
||||||
[the original paper](https://arxiv.org/abs/1911.02116). It was then fine-tuned on the task of NLI on the concatenated
|
[the original paper](https://arxiv.org/abs/1911.02116). It was then fine-tuned on the task of NLI on the concatenated
|
||||||
MNLI train set and the XNLI validation and test sets. Finally, it was trained for one additional epoch on only XNLI
|
MNLI train set and the XNLI validation and test sets. Finally, it was trained for one additional epoch on only XNLI
|
||||||
data where the the translations for the premise and hypothesis are shuffled such that the premise and hypothesis for
|
data where the translations for the premise and hypothesis are shuffled such that the premise and hypothesis for
|
||||||
each example come from the same original English example but the premise and hypothesis are of different languages.
|
each example come from the same original English example but the premise and hypothesis are of different languages.
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class MarianMTModel(BartForConditionalGeneration):
|
|||||||
>>> tok = MarianTokenizer.from_pretrained(mname)
|
>>> tok = MarianTokenizer.from_pretrained(mname)
|
||||||
>>> batch = tok.prepare_seq2seq_batch(src_texts=[sample_text]) # don't need tgt_text for inference
|
>>> batch = tok.prepare_seq2seq_batch(src_texts=[sample_text]) # don't need tgt_text for inference
|
||||||
>>> gen = model.generate(**batch) # for forward pass: model(**batch)
|
>>> gen = model.generate(**batch) # for forward pass: model(**batch)
|
||||||
>>> words: List[str] = tok.batch_decode(gen, skip_special_tokens=True) # returns "Where is the the bus stop ?"
|
>>> words: List[str] = tok.batch_decode(gen, skip_special_tokens=True) # returns "Where is the bus stop ?"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -646,7 +646,7 @@ class TFModelTesterMixin:
|
|||||||
emb_old.build(INPUT_SHAPE)
|
emb_old.build(INPUT_SHAPE)
|
||||||
# reshape the embeddings
|
# reshape the embeddings
|
||||||
new_embeddings = model._get_resized_embeddings(emb_old, size)
|
new_embeddings = model._get_resized_embeddings(emb_old, size)
|
||||||
# # check that the the resized embeddings size matches the desired size.
|
# # check that the resized embeddings size matches the desired size.
|
||||||
assert_size = size if size is not None else config.vocab_size
|
assert_size = size if size is not None else config.vocab_size
|
||||||
self.assertEqual(new_embeddings.shape[0], assert_size)
|
self.assertEqual(new_embeddings.shape[0], assert_size)
|
||||||
# check that weights remain the same after resizing
|
# check that weights remain the same after resizing
|
||||||
|
Loading…
Reference in New Issue
Block a user