Skip to content

Latest commit

 

History

History
89 lines (73 loc) · 21.4 KB

File metadata and controls

89 lines (73 loc) · 21.4 KB

MiniLM v2 On Groq

MiniLM v2 is a distilled model that employs a generalization of the deep self-attention distillation method that the authors of the linked paper introduced in their first paper MiniLm.

Get a Groq node interactively

qsub -I -l walltime=1:00:00

Go to directory with MiniLM v2 example.

cd ~/proof_points/natural_language_processing/minilm

Activate groqflow virtual Environment

conda activate groqflow

Install Requirements

Install the python dependencies using the requirements.txt file included with this proof point using the following command:

pip install -r requirements.txt

Run Training Job

python minilmv2.py
Sample Output
  $ python minilmv2.py 
  Downloading (…)okenizer_config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 350/350 [00:00<00:00, 1.64MB/s]
  Downloading (…)solve/main/vocab.txt: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 232k/232k [00:00<00:00, 1.72MB/s]
  Downloading (…)/main/tokenizer.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 466k/466k [00:00<00:00, 26.5MB/s]
  Downloading (…)cial_tokens_map.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 112/112 [00:00<00:00, 502kB/s]
  Downloading (…)lve/main/config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 612/612 [00:00<00:00, 7.19MB/s]
  Downloading pytorch_model.bin: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 90.9M/90.9M [00:00<00:00, 177MB/s]



  Building "minilmv2"
      ✓ Exporting PyTorch to ONNX   
      ✓ Optimizing ONNX file   
      ✓ Checking for Op support   
      ✓ Converting to FP16   
      ✓ Compiling model   
      ✓ Assembling model   

  Woohoo! Saved to ~/.cache/groqflow/minilmv2
  Preprocessing data.
  Downloading builder script:   0%|                                                                                                                                                                                                        |Downloading builder script: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7.43k/7.43k [00:00<00:00, 29.5MB/s]
  Downloading metadata:   0%|                                                                                                                                                                                                              |Downloading metadata: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 19.0k/19.0k [00:00<00:00, 70.8MB/s]
  Downloading readme:   0%|                                                                                                                                                                                                                |Downloading readme: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 9.98k/9.98k [00:00<00:00, 63.3MB/s]
  Downloading data files:   0%|                                                                                                                                                                                                                  | 0/3 [00:00<?, ?it/s]
  Downloading data: 709kB [00:00, 14.3MB/s]                                                                                                                                                                                                                            
  Downloading data files:  33%|███████████████████████████████████████████████████████████████████▎                                                                                                                                      | 1/3 [00:00<00:01,  1.34it/s]
  Downloading data: 205kB [00:00, 15.2MB/s]                                                                                                                                                                                                                            
  Downloading data files:  67%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▋                                                                   | 2/3 [00:01<00:00,  2.18it/s]
  Downloading data: 159kB [00:00, 19.7MB/s]                                                                                                                                                                                                                            
  Downloading data files: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3Downloading data files: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:01<00:00,  2.38it/s]
  Generating train split:   0%|                                                                                                                                                                                                        | 0/5Generating train split:  62%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████▋                                                                       | 3543/5749 [00:00<Generating train split: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5749/5749 [00:00<00:00, 38286.30 examples/s]
  Generating test split:   0%|                                                                                                                                                                                                         | 0/1Generating test split: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1379/1379 [00:00<00:00, 42959.55 examples/s]
  Generating dev split:   0%|                                                                                                                                                                                                          | 0/1Generating dev split: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1500/1500 [00:00<00:00, 43755.08 examples/s]
  Map:   0%|                                                                                                                                                                                                                           | 0/1Map: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1379/1379 [00:00<00:00, 30195.33 examples/s]

  Info: No inputs received for benchmark. Using the inputs provided during model compilation.
  /projects/datascience/sraskar/groq/groqflow/groqflow/groqmodel/execute.py:87: DeprecationWarning: `product` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `prod` instead.
  return tsp_runner(**example)
  Running inference on GroqChip.
  /projects/datascience/sraskar/groq/groqflow/groqflow/groqmodel/execute.py:87: DeprecationWarning: `product` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `prod` instead.
  return tsp_runner(**example)
  Running inference using PyTorch model (CPU).
  0%|                                                                                                                                                                                                                                       0%|▎                                                                                                                                                                                                                              | 2/13  0%|▋                                                                                                                                                                                                                              | 4/13  0%|▉                                                                                                                                                                                                                              | 6/13  1%|█▎                                                                                                                                                                                                                             | 8/13  1%|█▌                                                                                                                                                                                                                            | 10/13  1%|█▉                                                                                                                                                                                                                            | 12/13  1%|██▎                                                                                                                                                                                                                           | 14/13  1%|██▌                                                                                                                                                                                                                           | 16/13
   99%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 1372/13100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏| 1374/13100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌| 1376/13100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊| 1378/13100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1379/1379 [01:30<00:00, 15.23it/s]
+--------+---------------------------------------+-------------------------+----------------+----------------------+-------------+
| Source | Spearman Rank Correlation Coefficient | end-to-end latency (ms) | end-to-end IPS | on-chip latency (ms) | on-chip IPS |
+--------+---------------------------------------+-------------------------+----------------+----------------------+-------------+
|  cpu   |                 0.8203                |          65.67          |     15.23      |          --          |      --     |
|  groq  |                 0.8204                |           0.47          |    2144.87     |         0.38         |   2620.58   |
+--------+---------------------------------------+-------------------------+----------------+----------------------+-------------+