Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

awq

CONTAINERS IMAGES RUN BUILD

Quantization

Follow the instructions from https://github.com/mit-han-lab/llm-awq#usage to quantize your model of choice. Or use awq/quantize.py

./run.sh --env HUGGINGFACE_TOKEN=<YOUR-ACCESS-TOKEN> $(./autotag awq) /bin/bash -c \
  '/opt/awq/quantize.py --model=$(huggingface-downloader meta-llama/Llama-2-7b-hf) \
      --output=/data/models/awq/Llama-2-7b'

If you downloaded a model from the AWQ Model Zoo that already has the AWQ search results applied, you can load that with --load_awq and skip the search step (which can take a while and use lots of memory)

./run.sh --env HUGGINGFACE_TOKEN=<YOUR-ACCESS-TOKEN> $(./autotag awq) /bin/bash -c \
  '/opt/awq/quantize.py --model=$(huggingface-downloader meta-llama/Llama-2-7b-hf) \
      --output=/data/models/awq/Llama-2-7b \
      --load_awq=/data/models/awq/Llama-2-7b/llama-2-7b-w4-g128.pt'

This process will save the model with the real quantized weights (to a file like $OUTPUT/w4-g128-awq.pt)

Inference Benchmark

You can use the awq/benchmark.py tool to gather performance and memory measurements:

./run.sh --env HUGGINGFACE_TOKEN=<YOUR-ACCESS-TOKEN> $(./autotag awq) /bin/bash -c \
  '/opt/awq/benchmark.py --model=$(huggingface-downloader meta-llama/Llama-2-7b-hf) \
      --quant=/data/models/awq/Llama-2-7b/w4-g128-awq.pt'

Make sure that you load the output from the quantization steps above with --quant (use the model that ends with -awq.pt)

CONTAINERS
awq:0.1.0
   Aliases awq
   Requires L4T ['>=34.1.0']
   Dependencies build-essential cuda cudnn python numpy cmake onnx pytorch:2.2 torchvision huggingface_hub rust transformers
   Dockerfile Dockerfile
CONTAINER IMAGES
Repository/Tag Date Arch Size
  dustynv/awq:r35.2.1 2023-12-14 arm64 6.1GB
  dustynv/awq:r35.3.1 2023-12-15 arm64 6.1GB
  dustynv/awq:r35.4.1 2023-12-12 arm64 6.1GB
  dustynv/awq:r36.2.0 2023-12-15 arm64 7.8GB

Container images are compatible with other minor versions of JetPack/L4T:
    • L4T R32.7 containers can run on other versions of L4T R32.7 (JetPack 4.6+)
    • L4T R35.x containers can run on other versions of L4T R35.x (JetPack 5.1+)

RUN CONTAINER

To start the container, you can use jetson-containers run and autotag, or manually put together a docker run command:

# automatically pull or build a compatible container image
jetson-containers run $(autotag awq)

# or explicitly specify one of the container images above
jetson-containers run dustynv/awq:r35.3.1

# or if using 'docker run' (specify image and mounts/ect)
sudo docker run --runtime nvidia -it --rm --network=host dustynv/awq:r35.3.1

jetson-containers run forwards arguments to docker run with some defaults added (like --runtime nvidia, mounts a /data cache, and detects devices)
autotag finds a container image that's compatible with your version of JetPack/L4T - either locally, pulled from a registry, or by building it.

To mount your own directories into the container, use the -v or --volume flags:

jetson-containers run -v /path/on/host:/path/in/container $(autotag awq)

To launch the container running a command, as opposed to an interactive shell:

jetson-containers run $(autotag awq) my_app --abc xyz

You can pass any options to it that you would to docker run, and it'll print out the full command that it constructs before executing it.

BUILD CONTAINER

If you use autotag as shown above, it'll ask to build the container for you if needed. To manually build it, first do the system setup, then run:

jetson-containers build awq

The dependencies from above will be built into the container, and it'll be tested during. Run it with --help for build options.