-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* MPS quantization * mps dtypes * updates * fix names * typo * no bfloat16 for older macOS * fix typo * remove failing embedding quantization from MPS runs * bfloat -> current model precision * typo * missed bfloat16 to swotch to defaulkt precision * remove int8 quantization on mps * enable cpu fallback for mps on int4 * hack int4pack_mm for torch.float * typo * disable int4 because fp16 int4pack_mm not working for float16
- Loading branch information
Showing
5 changed files
with
104 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Run eager tests on MPS with dtypes | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test-mps: | ||
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main | ||
with: | ||
runner: macos-m1-stable | ||
script: | | ||
set -eou pipefail | ||
echo "::group::Print machine info" | ||
uname -a | ||
if [ $(uname -s) == Darwin ]; then | ||
sysctl machdep.cpu.brand_string | ||
sysctl machdep.cpu.core_count | ||
fi | ||
echo "::endgroup::" | ||
echo "::group::Install requirements" | ||
# Install requirements | ||
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu | ||
ls -la | ||
pwd | ||
pip install -r requirements.txt | ||
echo "::endgroup::" | ||
echo "::group::Download checkpoints" | ||
( | ||
mkdir -p checkpoints/stories15M | ||
pushd checkpoints/stories15M | ||
curl -fsSL -O https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.pt | ||
curl -fsSL -O https://github.com/karpathy/llama2.c/raw/master/tokenizer.model | ||
popd | ||
) | ||
echo "::endgroup::" | ||
echo "::group::Run inference" | ||
export MODEL_PATH=checkpoints/stories15M/stories15M.pt | ||
export MODEL_NAME=stories15M | ||
export MODEL_DIR=/tmp | ||
for DTYPE in float16 float32; do | ||
# if [ $(uname -s) == Darwin ]; then | ||
# export DTYPE=float16 | ||
# fi | ||
python generate.py --dtype ${DTYPE} --device mps --checkpoint-path ${MODEL_PATH} --temperature 0 > ./output_eager | ||
cat ./output_eager | ||
# python generate.py --dtype ${DTYPE} --device mps --quant '{"embedding" : {"bitwidth": 8, "group_size": 0}}' --checkpoint-path ${MODEL_PATH} --temperature 0 > ./output_eager | ||
# cat ./output_eager | ||
# python generate.py --dtype ${DTYPE} --device mps --quant '{"embedding" : {"bitwidth": 8, "group_size": 8}}' --checkpoint-path ${MODEL_PATH} --temperature 0 > ./output_eager | ||
# cat ./output_eager | ||
# python generate.py --dtype ${DTYPE} --device mps --quant '{"linear:int8" : {"bitwidth": 8, "group_size": 0}}' --checkpoint-path ${MODEL_PATH} --temperature 0 > ./output_eager | ||
# cat ./output_eager | ||
# python generate.py --dtype ${DTYPE} --device mps --quant '{"linear:int8" : {"bitwidth": 8, "group_size": 8}}' --checkpoint-path ${MODEL_PATH} --temperature 0 > ./output_eager | ||
# cat ./output_eager | ||
# PYTORCH_ENABLE_MPS_FALLBACK=1 python generate.py --dtype ${DTYPE} --device mps --quant '{"linear:int4" : {"group_size": 32}}' --checkpoint-path ${MODEL_PATH} --temperature 0 > ./output_eager | ||
# cat ./output_eager | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters