-
Notifications
You must be signed in to change notification settings - Fork 148
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
AttributeError: 'float' object has not attribute 'astype' #522
Comments
I suppose this is the same issue as in #516 (comment). So you are trying to compile the densenet and getting this error after you replaced the global average pooling by the average pooling? Could you share the changes you did to the densenet in your local file so that we can reproduce exactly the error you are getting? |
I replaced the globalaveragepool line with The pytorch model trained successfully. Also it was exported as onnx and the above issue arise when compiling to concrete. |
Can you also share what's your input shape? |
Input is 3x 150 x 150 image. |
If I put a out = F.adaptive_avg_pool2d(out, (1, 1)) But the Setting a |
Thanks for the bug report. It's hard to tell where the error comes from. The line you show uses numpy functions so it should return numpy.float instead of python float. Could you print the values and types of stats.rmax, stats.rmin, options.n_bits, self.offset just before that line? Alternatively could you give code that reproduces the issue ? |
Sorry but that's not enough to help you debug this. Could you modify the code of quantizer.py as described in the previous comment and give the output ? |
Hi, Thank you for your reponse. |
Would it be possible for you to setup a GitHub repo with the code? It's not easy for us to reproduce with screenshots. That being said, I see here that it's trying to quantize to 1024 bits. This is certainly going to be a problem. Are you setting the |
The Please use |
Hi @andrei-stoian-zama , I really appreciate your help. I have added code to github repo. Here is the link.
|
One first observation is that the Furthermore doing:
raises the I tried exporting only the
and it raises Can you please provide some minimal code that reproduces the |
Thank you for your help.
|
@andrei-stoian-zama |
I will close this thread as there is one about the missing GlobalAveragePooling. For image classification please see the cifar example: https://github.com/zama-ai/concrete-ml/tree/main/use_case_examples/cifar/cifar_brevitas_finetuning |
Summary
I have created a image classification model in PyTorch and trained on unencrypted data. After that the model is exported using ONNX and import back and checked.
Now when the model is compiled with "compile_onnx_model", it gives following error.
Description
Step by step procedure someone should follow to trigger the bug:
minimal POC to trigger the bug
The text was updated successfully, but these errors were encountered: