-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Quant] Add FX support in quantization examples #5797
Commits on Apr 10, 2022
-
[Quant] Add FX support in quantization examples
Summary: Previously, the quantization examples use only eager mode quantization. This commit adds support for FX mode quantization as well. TODO: provide accuracy comparison. Test Plan: python train_quantization.py --device='cpu' --post-training-quantize --backend='fbgemm' --model='$MODEL' model: $MODEL is one of googlenet, inception_v3, resnet18, resnet50, resnext101_32x8d, shufflenet_v2_x0_5 and shufflenet_v2_x1_0 Reviewers: jerryzh168, vkuzo Subscribers: jerryzh168, vkuzo [ghstack-poisoned]
Configuration menu - View commit details
-
Copy full SHA for beff9a2 - Browse repository at this point
Copy the full SHA beff9a2View commit details
Commits on Apr 12, 2022
-
Update on "[Quant] Add FX support in quantization examples"
Summary: Previously, the quantization examples use only eager mode quantization. This commit adds support for FX mode quantization as well. TODO: provide accuracy comparison. Test Plan: python train_quantization.py --device='cpu' --post-training-quantize --backend='fbgemm' --model='$MODEL' model: $MODEL is one of googlenet, inception_v3, resnet18, resnet50, resnext101_32x8d, shufflenet_v2_x0_5 and shufflenet_v2_x1_0 Reviewers: jerryzh168, vkuzo Subscribers: jerryzh168, vkuzo [ghstack-poisoned]
Configuration menu - View commit details
-
Copy full SHA for d5373ca - Browse repository at this point
Copy the full SHA d5373caView commit details -
Update on "[Quant] Add FX support in quantization examples"
Summary: Previously, the quantization examples use only eager mode quantization. This commit adds support for FX mode quantization as well. TODO: provide accuracy comparison. Test Plan: python train_quantization.py --device='cpu' --post-training-quantize --backend='fbgemm' --model='$MODEL' model: $MODEL is one of googlenet, inception_v3, resnet18, resnet50, resnext101_32x8d, shufflenet_v2_x0_5 and shufflenet_v2_x1_0 Reviewers: jerryzh168, vkuzo Subscribers: jerryzh168, vkuzo [ghstack-poisoned]
Configuration menu - View commit details
-
Copy full SHA for 1e39944 - Browse repository at this point
Copy the full SHA 1e39944View commit details
Commits on Apr 13, 2022
-
Update on "[Quant] Add FX support in quantization examples"
Summary: Previously, the quantization examples use only eager mode quantization. This commit adds support for FX mode quantization as well. TODO: provide accuracy comparison. Test Plan: python train_quantization.py --device='cpu' --post-training-quantize --backend='fbgemm' --model='$MODEL' model: $MODEL is one of googlenet, inception_v3, resnet18, resnet50, resnext101_32x8d, shufflenet_v2_x0_5 and shufflenet_v2_x1_0 Reviewers: jerryzh168, vkuzo Subscribers: jerryzh168, vkuzo [ghstack-poisoned]
Configuration menu - View commit details
-
Copy full SHA for 0a4a7bf - Browse repository at this point
Copy the full SHA 0a4a7bfView commit details -
Update on "[Quant] Add FX support in quantization examples"
Summary: Previously, the quantization examples use only eager mode quantization. This commit adds support for FX mode quantization as well. Test Plan: ``` # MODEL is one of googlenet, inception_v3, resnet18, resnet50, resnext101_32x8d, # shufflenet_v2_x0_5, shufflenet_v2_x1_0, mobilenet_v2, mobilenet_v3_large # eager python train_quantization.py --device="cpu" --post-training-quantize --backend="fbgemm" --model="$MODEL" --weights="IMAGENET1K_V1" --quantization-workflow-type="eager_mode_quantization" # fx python train_quantization.py --device="cpu" --post-training-quantize --backend="fbgemm" --model="$MODEL" --weights="IMAGENET1K_V1" --quantization-workflow-type="eager_mode_quantization" # eager QAT (mobilenet only) python train_quantization.py --device="cuda" --backend="fbgemm" --model="$MODEL" --epochs=10 --weights="IMAGENET1K_V1" --quantization-workflow-type="eager_mode_quantization" # fx QAT (mobilenet only) python train_quantization.py --device="cuda" --backend="fbgemm" --model="$MODEL" --epochs=10 --weights="IMAGENET1K_V1" --quantization-workflow-type="fx_graph_mode_quantization" ``` Results: - "Before" column refers to accuracies reported [here](https://github.com/pytorch/vision/blob/main/docs/source/models.rst#quantized-models) - TODO: Add results for QAT mobilenet after it's done <img width="641" alt="Screen Shot 2022-04-12 at 10 58 01 PM" src="https://user-images.githubusercontent.com/2133137/163091177-e1c1c666-c3f7-40c3-8866-c0743c264721.png"> Reviewers: jerryzh168, vkuzo Subscribers: jerryzh168, vkuzo [ghstack-poisoned]
Configuration menu - View commit details
-
Copy full SHA for 2475285 - Browse repository at this point
Copy the full SHA 2475285View commit details
Commits on Apr 14, 2022
-
Update on "[Quant] Add FX support in quantization examples"
Summary: Previously, the quantization examples use only eager mode quantization. This commit adds support for FX mode quantization as well. Test Plan: ``` # ==================== PTQ ==================== # MODEL is one of googlenet, inception_v3, resnet18, resnet50, resnext101_32x8d, # shufflenet_v2_x0_5, shufflenet_v2_x1_0 # eager python train_quantization.py --device="cpu" --post-training-quantize --backend="fbgemm"\ --model="$MODEL" --weights="IMAGENET1K_V1" --quantization-workflow-type="eager_mode_quantization" # fx python train_quantization.py --device="cpu" --post-training-quantize --backend="fbgemm"\ --model="$MODEL" --weights="IMAGENET1K_V1" --quantization-workflow-type="eager_mode_quantization" # ==================== QAT ==================== # mobilenet_v2 eager python train_quantization.py --device="cuda" --backend="qnnpack" --model="mobilenet_v2"\ --epochs=10 --workers=64 --weights="IMAGENET1K_V1" --lr=0.0001 --weight-decay=0.0001\ --quantization-workflow-type="eager_mode_quantization" # mobilenet_v2 fx python train_quantization.py --device="cuda" --backend="qnnpack" --model="mobilenet_v2"\ --epochs=10 --workers=64 --weights="IMAGENET1K_V1" --lr=0.0001 --weight-decay=0.0001\ --quantization-workflow-type="fx_graph_mode_quantization" # mobilenet_v3_large eager python train_quantization.py --device="cuda" --backend="qnnpack" --model="mobilenet_v3_large"\ --epochs=10 --workers=64 --weights="IMAGENET1K_V1" --lr=0.001 --weight-decay=0.00001\ --quantization-workflow-type="eager_mode_quantization" # mobilenet_v3_large fx python train_quantization.py --device="cuda" --backend="qnnpack" --model="mobilenet_v3_large"\ --epochs=10 --workers=64 --weights="IMAGENET1K_V1" --lr=0.001 --weight-decay=0.00001\ --quantization-workflow-type="fx_graph_mode_quantization" ``` Reviewers: jerryzh168, vkuzo Subscribers: jerryzh168, vkuzo [ghstack-poisoned]
Configuration menu - View commit details
-
Copy full SHA for a84092a - Browse repository at this point
Copy the full SHA a84092aView commit details
Commits on Apr 21, 2022
-
Update on "[Quant] Add FX support in quantization examples"
Summary: Previously, the quantization examples use only eager mode quantization. This commit adds support for FX mode quantization as well. Test Plan: ``` # ==================== PTQ ==================== # MODEL is one of googlenet, inception_v3, resnet18, resnet50, resnext101_32x8d, # shufflenet_v2_x0_5, shufflenet_v2_x1_0 # eager python train_quantization.py --device="cpu" --post-training-quantize --backend="fbgemm"\ --model="$MODEL" --weights="IMAGENET1K_V1" --quantization-workflow-type="eager_mode_quantization" # fx python train_quantization.py --device="cpu" --post-training-quantize --backend="fbgemm"\ --model="$MODEL" --weights="IMAGENET1K_V1" --quantization-workflow-type="eager_mode_quantization" # ==================== QAT ==================== # mobilenet_v2 eager python train_quantization.py --device="cuda" --backend="qnnpack" --model="mobilenet_v2"\ --epochs=10 --workers=64 --weights="IMAGENET1K_V1" --lr=0.0001 --weight-decay=0.0001\ --quantization-workflow-type="eager_mode_quantization" # mobilenet_v2 fx python train_quantization.py --device="cuda" --backend="qnnpack" --model="mobilenet_v2"\ --epochs=10 --workers=64 --weights="IMAGENET1K_V1" --lr=0.0001 --weight-decay=0.0001\ --quantization-workflow-type="fx_graph_mode_quantization" # mobilenet_v3_large eager python train_quantization.py --device="cuda" --backend="qnnpack" --model="mobilenet_v3_large"\ --epochs=10 --workers=64 --weights="IMAGENET1K_V1" --lr=0.001 --weight-decay=0.00001\ --quantization-workflow-type="eager_mode_quantization" # mobilenet_v3_large fx python train_quantization.py --device="cuda" --backend="qnnpack" --model="mobilenet_v3_large"\ --epochs=10 --workers=64 --weights="IMAGENET1K_V1" --lr=0.001 --weight-decay=0.00001\ --quantization-workflow-type="fx_graph_mode_quantization" ``` Reviewers: jerryzh168, vkuzo Subscribers: jerryzh168, vkuzo [ghstack-poisoned]
Configuration menu - View commit details
-
Copy full SHA for 4f4eb69 - Browse repository at this point
Copy the full SHA 4f4eb69View commit details
Commits on Apr 22, 2022
-
Update on "[Quant] Add FX support in quantization examples"
Summary: Previously, the quantization examples use only eager mode quantization. This commit adds support for FX mode quantization as well. Test Plan: ``` # ==================== PTQ ==================== # MODEL is one of googlenet, inception_v3, resnet18, resnet50, resnext101_32x8d, # shufflenet_v2_x0_5, shufflenet_v2_x1_0 # eager python train_quantization.py --device="cpu" --post-training-quantize --backend="fbgemm"\ --model="$MODEL" --weights="IMAGENET1K_V1" --quantization-workflow-type="eager_mode_quantization" # fx python train_quantization.py --device="cpu" --post-training-quantize --backend="fbgemm"\ --model="$MODEL" --weights="IMAGENET1K_V1" --quantization-workflow-type="eager_mode_quantization" # ==================== QAT ==================== # mobilenet_v2 eager python train_quantization.py --device="cuda" --backend="qnnpack" --model="mobilenet_v2"\ --epochs=10 --workers=64 --weights="IMAGENET1K_V1" --lr=0.0001 --weight-decay=0.0001\ --quantization-workflow-type="eager_mode_quantization" # mobilenet_v2 fx python train_quantization.py --device="cuda" --backend="qnnpack" --model="mobilenet_v2"\ --epochs=10 --workers=64 --weights="IMAGENET1K_V1" --lr=0.0001 --weight-decay=0.0001\ --quantization-workflow-type="fx_graph_mode_quantization" # mobilenet_v3_large eager python train_quantization.py --device="cuda" --backend="qnnpack" --model="mobilenet_v3_large"\ --epochs=10 --workers=64 --weights="IMAGENET1K_V1" --lr=0.001 --weight-decay=0.00001\ --quantization-workflow-type="eager_mode_quantization" # mobilenet_v3_large fx python train_quantization.py --device="cuda" --backend="qnnpack" --model="mobilenet_v3_large"\ --epochs=10 --workers=64 --weights="IMAGENET1K_V1" --lr=0.001 --weight-decay=0.00001\ --quantization-workflow-type="fx_graph_mode_quantization" ``` <img width="638" alt="Screen Shot 2022-04-21 at 8 33 41 PM" src="https://user-images.githubusercontent.com/2133137/164572469-5848c86b-0813-42f6-bcb7-0298ff4bb25b.png"> Reviewers: jerryzh168, vkuzo Subscribers: jerryzh168, vkuzo [ghstack-poisoned]
Configuration menu - View commit details
-
Copy full SHA for 9978cb0 - Browse repository at this point
Copy the full SHA 9978cb0View commit details