Add a short README for the OPT examples and small tweaks. (#1793)

* Small changes to OPT example.

* Update opt README.

* Add a few modes to batch script.

* Update README.md
This commit is contained in:
Ean Garvey
2023-08-24 19:26:11 -05:00
committed by GitHub
parent 610813c72f
commit 07f6f4a2f7
3 changed files with 31 additions and 5 deletions

View File

@@ -1,3 +1,26 @@
# Running Different OPT Variants
# Run OPT for sentence completion through SHARK
To run different sizes of OPT, change the string `OPT_MODEL` string in `opt_torch_test.py`. The default is 350m parameters. 66b cases also exist in the file, simply uncomment the test cases.
From base SHARK directory, follow instructions to set up a virtual environment with SHARK. (`./setup_venv.sh` or `./setup_venv.ps1`)
Then, you may run opt_causallm.py to get a very simple sentence completion application running through SHARK
```
python opt_causallm.py
```
# Run OPT performance comparison on SHARK vs. PyTorch
```
python opt_perf_comparison.py --max-seq-len=512 --model-name=facebook/opt-1.3b \
--platform=shark
```
Any OPT model from huggingface should work with this script, and you can choose between `--platform=shark` or `--platform=huggingface` to generate benchmarks of OPT inference on SHARK / PyTorch.
# Run a small suite of OPT models through the benchmark script
```
python opt_perf_comparison_batch.py
```
This script will run benchmarks from a suite of OPT configurations:
- Sequence Lengths: 32, 128, 256, 512
- Parameter Counts: 125m, 350m, 1.3b
note: Most of these scripts are written for use on CPU, as perf comparisons against pytorch can be problematic across platforms otherwise.

View File

@@ -4,7 +4,10 @@ PyTorch.
Usage Example:
python opt_perf_comparision.py --max-seq-len=32 --model-name=facebook/opt-125m \
python opt_perf_comparison.py --max-seq-len=32 --model-name=facebook/opt-125m \
--platform=shark
python opt_perf_comparison.py --max-seq-len=512 --model-name=facebook/opt-1.3b \
--platform=shark
See parse_args() below for command line argument usage.

View File

@@ -11,8 +11,8 @@ import subprocess
def make_commands() -> Iterable[List[str]]:
command = shlex.split("python opt_perf_comparison.py --no-save-json")
max_seq_lens = [32, 128, 512]
model_names = ["facebook/opt-" + e for e in ["125m", "350m"]]
max_seq_lens = [32, 128, 256, 512]
model_names = ["facebook/opt-" + e for e in ["125m", "350m", "1.3b"]]
for max_seq_len in max_seq_lens:
for model_name in model_names:
yield command + [