Instantiating an object `model_pytorch` of the class `ModelPyTorch` would actually allocate memory for the model weights and attach them to the attributes `self.key_proj`, `self.value_proj`, `self.query_proj`, and `self.logits.proj`. We could access the weights via:
Instantiating an object `model_pytorch` of the class `ModelPyTorch` would actually allocate memory for the model weights and attach them to the attributes `self.key_proj`, `self.value_proj`, `self.query_proj`, and `self.logits.proj`. We could access the weights via:
@@ -1224,25 +1224,25 @@ Sometimes you might be using different libraries or a very specific application
...
@@ -1224,25 +1224,25 @@ Sometimes you might be using different libraries or a very specific application
A common use case is how to load files you have in your model repository in the Hub from the Streamlit demo. The `huggingface_hub` library is here to help you!
A common use case is how to load files you have in your model repository in the Hub from the Streamlit demo. The `huggingface_hub` library is here to help you!
```
```bash
pip install huggingface_hub
pip install huggingface_hub
```
```
Here is an example downloading (and caching!) a specific file directly from the Hub
Here is an example downloading (and caching!) a specific file directly from the Hub
In many cases you will want to download the full repository. Here is an example downloading all the files from a repo. You can even specify specific revisions!
In many cases you will want to download the full repository. Here is an example downloading all the files from a repo. You can even specify specific revisions!
### Benchmark the INT8 QAT ONNX model inference with [ONNX Runtime-TRT](https://onnxruntime.ai/docs/execution-providers/TensorRT-ExecutionProvider.html) using dummy input
### Benchmark the INT8 QAT ONNX model inference with [ONNX Runtime-TRT](https://onnxruntime.ai/docs/execution-providers/TensorRT-ExecutionProvider.html) using dummy input
```
```bash
python3 ort-infer-benchmark.py
python3 ort-infer-benchmark.py
```
```
### Evaluate the INT8 QAT ONNX model inference with TensorRT
### Evaluate the INT8 QAT ONNX model inference with TensorRT
@@ -45,7 +45,7 @@ We publish two `base` models which can serve as a starting point for finetuning
...
@@ -45,7 +45,7 @@ We publish two `base` models which can serve as a starting point for finetuning
The `base` models initialize the question encoder with [`facebook/dpr-question_encoder-single-nq-base`](https://huggingface.co/facebook/dpr-question_encoder-single-nq-base) and the generator with [`facebook/bart-large`](https://huggingface.co/facebook/bart-large).
The `base` models initialize the question encoder with [`facebook/dpr-question_encoder-single-nq-base`](https://huggingface.co/facebook/dpr-question_encoder-single-nq-base) and the generator with [`facebook/bart-large`](https://huggingface.co/facebook/bart-large).
If you would like to initialize finetuning with a base model using different question encoder and generator architectures, you can build it with a consolidation script, e.g.:
If you would like to initialize finetuning with a base model using different question encoder and generator architectures, you can build it with a consolidation script, e.g.:
@@ -134,7 +134,7 @@ which helps with capping GPU memory usage.
...
@@ -134,7 +134,7 @@ which helps with capping GPU memory usage.
To learn how to deploy Deepspeed Integration please refer to [this guide](https://huggingface.co/transformers/main/main_classes/deepspeed.html#deepspeed-trainer-integration).
To learn how to deploy Deepspeed Integration please refer to [this guide](https://huggingface.co/transformers/main/main_classes/deepspeed.html#deepspeed-trainer-integration).
But to get started quickly all you need is to install:
But to get started quickly all you need is to install:
```
```bash
pip install deepspeed
pip install deepspeed
```
```
and then use the default configuration files in this directory:
and then use the default configuration files in this directory:
...
@@ -148,7 +148,7 @@ Here are examples of how you can use DeepSpeed:
...
@@ -148,7 +148,7 @@ Here are examples of how you can use DeepSpeed:
@@ -21,7 +21,7 @@ classification performance to the original zero-shot model
...
@@ -21,7 +21,7 @@ classification performance to the original zero-shot model
A teacher NLI model can be distilled to a more efficient student model by running [`distill_classifier.py`](https://github.com/huggingface/transformers/blob/main/examples/research_projects/zero-shot-distillation/distill_classifier.py):
A teacher NLI model can be distilled to a more efficient student model by running [`distill_classifier.py`](https://github.com/huggingface/transformers/blob/main/examples/research_projects/zero-shot-distillation/distill_classifier.py):
@@ -41,7 +41,7 @@ can also be used by passing the name of the TPU resource with the `--tpu` argume
...
@@ -41,7 +41,7 @@ can also be used by passing the name of the TPU resource with the `--tpu` argume
This script trains a masked language model.
This script trains a masked language model.
### Example command
### Example command
```
```bash
python run_mlm.py \
python run_mlm.py \
--model_name_or_path distilbert-base-cased \
--model_name_or_path distilbert-base-cased \
--output_dir output \
--output_dir output \
...
@@ -50,7 +50,7 @@ python run_mlm.py \
...
@@ -50,7 +50,7 @@ python run_mlm.py \
```
```
When using a custom dataset, the validation file can be separately passed as an input argument. Otherwise some split (customizable) of training data is used as validation.
When using a custom dataset, the validation file can be separately passed as an input argument. Otherwise some split (customizable) of training data is used as validation.
```
```bash
python run_mlm.py \
python run_mlm.py \
--model_name_or_path distilbert-base-cased \
--model_name_or_path distilbert-base-cased \
--output_dir output \
--output_dir output \
...
@@ -62,7 +62,7 @@ python run_mlm.py \
...
@@ -62,7 +62,7 @@ python run_mlm.py \
This script trains a causal language model.
This script trains a causal language model.
### Example command
### Example command
```
```bash
python run_clm.py \
python run_clm.py \
--model_name_or_path distilgpt2 \
--model_name_or_path distilgpt2 \
--output_dir output \
--output_dir output \
...
@@ -72,7 +72,7 @@ python run_clm.py \
...
@@ -72,7 +72,7 @@ python run_clm.py \
When using a custom dataset, the validation file can be separately passed as an input argument. Otherwise some split (customizable) of training data is used as validation.
When using a custom dataset, the validation file can be separately passed as an input argument. Otherwise some split (customizable) of training data is used as validation.