Skip to content
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

ValueError: Please either set all three 'ordered_module_input_names', 'ordered_module_output_names' and 'quant_layers_dict' or none of them. #630

Open
fabecode opened this issue Apr 19, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@fabecode
Copy link

Summary

Hello, I am trying to create a custom ScatterElements ONNX node in Concrete ML.

After the conversion of the graph nodes from ONNX to NumPy, I face the following error: ValueError: Please either set all three 'ordered_module_input_names', 'ordered_module_output_names' and 'quant_layers_dict' or none of them. from concrete/ml/quantization/quantized_module.py", line 109. Below is a snippet of where the ValueError was raised:

 all_or_none_params = [
            ordered_module_input_names,
            ordered_module_output_names,
            quant_layers_dict,
        ]
  if not (
            all(v is None or v == {} for v in all_or_none_params)
            or not any(v is None or v == {} for v in all_or_none_params)
        ):
            raise ValueError(
                "Please either set all three 'ordered_module_input_names', "
                "'ordered_module_output_names' and 'quant_layers_dict' or none of them."
            )

Upon inspection, the variables hold the following values:

  • ordered_module_input_names: <generator object ONNXConverter.quantize_module.<locals>.<genexpr> at 0x7f0168245660>
  • ordered_module_output_names: <generator object ONNXConverter.quantize_module.<locals>.<genexpr> at 0x7f0168245740>
  • quant_layers_dict: {}

Do you have any suggestions on what went wrong and any tips on how to debug above? What is the input and output of above supposed to look like? Thank you!

@fabecode fabecode added the bug Something isn't working label Apr 19, 2024
@fd0r
Copy link
Collaborator

fd0r commented Apr 22, 2024

Hello @fabecode , would you mind sharing a link to the current state of your modifications?

It would make it easier for us to help you with access to the code changes you made.

@fabecode
Copy link
Author

Hi @fd0r,

Here is the link to my GitHub repository: fabecode/GraphML-FHE. You could view my quantised GNN model in the GINe_FHE class of models.py, and the the state of my Concrete-ML library modifications in the commit history of my local concrete-ml package. If you would like to run the GNN model, you could follow the quick command in gnn_fhe_pipline README.md.

Upon further investigation of the ValueError in quantized_module.py, it seems that the root cause stems from the _quantize_layers function in post_training.py. The has_variable_inputs in line 580 is False, leading to the if block being skipped over, and quant_ops_dict hence being empty.

Any advice or suggestions would be really appreciated. Thank you so much!

@RomanBredehoft
Copy link
Collaborator

RomanBredehoft commented May 2, 2024

Hello @fabecode ,
We are currently taking a look at it, we will get back to you once we have some news about it 🙂

Thanks for your patience !

@fabecode
Copy link
Author

fabecode commented May 3, 2024

Thank you @RomanBredehoft. Appreciate your help!

In relation to my project, I have also just applied for the Zama Grant program at zama-ai/bounty-program#119.

Looking forward to hearing from you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants