cvlab-yonsei / ewgs Goto Github PK
View Code? Open in Web Editor NEWAn official implementation of "Network Quantization with Element-wise Gradient Scaling" (CVPR 2021) in PyTorch.
License: GNU General Public License v3.0
An official implementation of "Network Quantization with Element-wise Gradient Scaling" (CVPR 2021) in PyTorch.
License: GNU General Public License v3.0
Dear Author,
Above all, thank you for sharing nice codes.
BTW, about quant training on CIFAR10,
Have you ever faced with OOM issues by loss.backward(create_graph=True) in update_grad_scales?
When I tried it by below args, I was faced with the "RuntimeError: CUDA out of memory" issue.
python train_quant.py --gpu_id '0'
--weight_levels 8
--act_levels 8
--baseline False
--use_hessian True
--load_pretrain True
--pretrain_path '../results/ResNet20_CIFAR10/fp/checkpoint/last_checkpoint.pth'
--log_dir '../results/ResNet20_CIFAR10/ours(hess)/W8A8/
Do you have some idea to avoid this issue?
Thank you in advance.
Hello,
Thanks for the great work.
I'm trying to run CIFAR code as shown below from run.sh.
However, I couldn't find a reference to the pretrain_path models.
Is there any way/hint to get them?
Thanks
python train_quant.py --gpu_id '0' \
--weight_levels 2 \
--act_levels 2 \
--baseline False \
--use_hessian True \
--load_pretrain True \
--pretrain_path '../results/ResNet20_CIFAR10/fp/checkpoint/last_checkpoint.pth' \
--log_dir '../results/ResNet20_CIFAR10/ours(hess)/W1A1/'
Can you please provide the script to reproduce the results in Table 5 for STE and EWGS on Imagenet trained using Mobilenetv2?
I'm leaving an issue to see if there's something I haven't caught in the code.
Did you guys quantize the results of the shortcut??
because at QBasicBlock, it does not have a quantization part after addition (EWGS/CIFAR10/custom_models.py Line 83~85).
Thanks.
using model = torch.nn.DataParallel(model)
, buff_weight and buff_act cannot return correctly in update_grad_scales. @junghyup-lee
Thanks for your great paper, can you share your total training time and the number of GPU used, or to say, GPU hours? because in my experiment of EWGS, it is very slow.
Hello, author.Thank you so much for open-source code,I have some problems with this code.
First,I run the code based on the Cifar10 dataset, I get the same accuracy as the original paper.
Then,I use ImageNet dataset(ILSVRC2012) to do experiments,I do a 4bit quantization based on Resnet34,I train my model using pretrained model,and I didn't modify the network structure and Super parameter configuration,unfortunately,after 100epochs,I only get 71.4% (Top1) Classification accuracy,It is 73.9% in the original paper.
So I hope you can help me sincerely.
When I train yolox,in EWGS with use_hessian,the final delta can reach at nan:
def backward(ctx, g):
diff = ctx.saved_tensors[0]
delta = ctx._scaling_factor
scale = 1 + delta * torch.sign(g)*diff
return g * scale, None, None
where the delta is calculated by hessian factor
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.