Skip to content

Commit 53cfe56

Browse files
lucylqmalfet
authored andcommitted
rename quant config files (#510)
1 parent e53c5bd commit 53cfe56

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ with `python3 torchchat.py remove llama3`.
8080
* in Chat mode
8181
* in Generate mode
8282
* Fine-tuned models from torchtune
83-
83+
8484

8585
## Running via PyTorch / Python
8686

@@ -92,7 +92,7 @@ In chat mode, the LLM engages in a back-and-forth dialogue with the user. It res
9292

9393
```bash
9494
# Llama 3 8B Instruct
95-
python3 torchchat.py chat llama3
95+
python3 torchchat.py chat llama3
9696
```
9797

9898
```
@@ -134,11 +134,11 @@ Enter some text in the input box, then hit the enter key or click the “SEND”
134134

135135
Quantization is the process of converting a model into a more memory-efficient representation. Quantization is particularly important for accelerators -- to take advantage of the available memory bandwidth, and fit in the often limited high-speed memory in accelerators – and mobile devices – to fit in the typically very limited memory of mobile devices.
136136

137-
Depending on the model and the target device, different quantization recipes may be applied. torchchat contains two example configurations to optimize performance for GPU-based systems `config/data/qconfig_gpu.json`, and mobile systems `config/data/qconfig_mobile.json`. The GPU configuration is targeted towards optimizing for memory bandwidth which is a scarce resource in powerful GPUs (and to a less degree, memory footprint to fit large models into a device's memory). The mobile configuration is targeted towards optimizing for memory fotoprint because in many devices, a single application is limited to as little as GB or less of memory.
137+
Depending on the model and the target device, different quantization recipes may be applied. torchchat contains two example configurations to optimize performance for GPU-based systems `config/data/cuda.json`, and mobile systems `config/data/mobile.json`. The GPU configuration is targeted towards optimizing for memory bandwidth which is a scarce resource in powerful GPUs (and to a less degree, memory footprint to fit large models into a device's memory). The mobile configuration is targeted towards optimizing for memory fotoprint because in many devices, a single application is limited to as little as GB or less of memory.
138138

139139
You can use the quantization recipes in conjunction with any of the `chat`, `generate` and `browser` commands to test their impact and accelerate model execution. You will apply these recipes to the `export` comamnds below, to optimize the exported models. For example:
140140
```
141-
python3 torchchat.py chat llama3 --quantize config/data/qconfig_gpu.json
141+
python3 torchchat.py chat llama3 --quantize config/data/cuda.json
142142
```
143143
To adapt these recipes or wrote your own, please refer to the [quantization overview](docs/quantization.md).
144144

@@ -157,10 +157,10 @@ The following example uses the Llama3 8B model.
157157
python3 torchchat.py export llama3 --output-dso-path llama3.so
158158
159159
# Execute
160-
python3 torchchat.py generate llama3 --quantize config/data/qconfig_gpu.json--dso-path llama3.so --prompt "Hello my name is"
160+
python3 torchchat.py generate llama3 --quantize config/data/cuda.json--dso-path llama3.so --prompt "Hello my name is"
161161
```
162162

163-
NOTE: We use `--quantize config/data/qconfig_gpu.json` to quantize the llama3 model to reduce model size and improve performance for on-device use cases.
163+
NOTE: We use `--quantize config/data/cuda.json` to quantize the llama3 model to reduce model size and improve performance for on-device use cases.
164164

165165
**Build Native Runner Binary**
166166

@@ -185,12 +185,12 @@ Before running ExecuTorch commands, you must first set-up ExecuTorch in torchcha
185185
The following example uses the Llama3 8B model.
186186
```
187187
# Compile
188-
python3 torchchat.py export llama3 --quantize config/data/qconfig_mobile.json --output-pte-path llama3.pte
188+
python3 torchchat.py export llama3 --quantize config/data/mobile.json --output-pte-path llama3.pte
189189
190190
# Execute
191191
python3 torchchat.py generate llama3 --device cpu --pte-path llama3.pte --prompt "Hello my name is"
192192
```
193-
NOTE: We use `--quantize config/data/qconfig_mobile.json` to quantize the llama3 model to reduce model size and improve performance for on-device use cases.
193+
NOTE: We use `--quantize config/data/mobile.json` to quantize the llama3 model to reduce model size and improve performance for on-device use cases.
194194

195195
See below under [Mobile Execution](#mobile-execution) if you want to deploy and execute a model in your iOS or Android app.
196196

@@ -336,6 +336,6 @@ you've built around local LLM inference.
336336

337337

338338
## License
339-
torchchat is released under the [BSD 3 license](LICENSE). (Additional code in this
339+
torchchat is released under the [BSD 3 license](LICENSE). (Additional code in this
340340
distribution is covered by the MIT and Apache Open Source licenses.) However you may have other legal obligations
341341
that govern your use of content, such as the terms of service for third-party models.
File renamed without changes.
File renamed without changes.

docs/quantization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Due to the larger vocabulary size of llama3, we also recommend quantizing the em
2929
*** [GPTQ](https://arxiv.org/abs/2210.17323) and [HQQ](https://mobiusml.github.io/hqq_blog/) are two different algorithms to address accuracy loss when using lower bit quantization. Due to HQQ relying on data/calibration free quantization, it tends to take less time to quantize model.
3030

3131
## Quantization API
32-
Quantization options are passed in json format either as a config file (see [qconfig_gpu.json](../config/data/qconfig_gpu.json) and [qconfig_mobile.json](../config/data/qconfig_mobile.json)) or a JSON string.
32+
Quantization options are passed in json format either as a config file (see [cuda.json](../config/data/cuda.json) and [mobile.json](../config/data/mobile.json)) or a JSON string.
3333

3434
The expected JSON format is described below. Refer to the tables above for valid `bitwidth` and `groupsize` values.
3535

0 commit comments

Comments
 (0)