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

Error when importing 0.3.0 #218

Open
scarlettekk opened this issue Sep 12, 2024 · 3 comments
Open

Error when importing 0.3.0 #218

scarlettekk opened this issue Sep 12, 2024 · 3 comments
Assignees
Labels
status:awaiting user response When awaiting user response status:stale type:build/install Build and install issues type:support For use-related issues

Comments

@scarlettekk
Copy link

Description of the bug:

I was trying to use the latest commit version to convert gemma2 since it seems like 0.2.0 doesn't support it. However, I can't even import it:

Traceback (most recent call last):
  File "/home/scarlett/git/gemma/convert.py", line 21, in <module>
    import ai_edge_torch
  File "/home/scarlett/.local/share/virtualenvs/gemma-U5bxnpzZ/lib/python3.11/site-packages/ai_edge_torch/__init__.py", line 16, in <module>
    from ai_edge_torch._convert.converter import convert
  File "/home/scarlett/.local/share/virtualenvs/gemma-U5bxnpzZ/lib/python3.11/site-packages/ai_edge_torch/_convert/converter.py", line 21, in <module>
    from ai_edge_torch._convert import conversion
  File "/home/scarlett/.local/share/virtualenvs/gemma-U5bxnpzZ/lib/python3.11/site-packages/ai_edge_torch/_convert/conversion.py", line 20, in <module>
    from ai_edge_torch import lowertools
  File "/home/scarlett/.local/share/virtualenvs/gemma-U5bxnpzZ/lib/python3.11/site-packages/ai_edge_torch/lowertools/__init__.py", line 16, in <module>
    from ._shim import *
  File "/home/scarlett/.local/share/virtualenvs/gemma-U5bxnpzZ/lib/python3.11/site-packages/ai_edge_torch/lowertools/_shim.py", line 25, in <module>
    from ai_edge_torch.lowertools import torch_xla_utils as utils
  File "/home/scarlett/.local/share/virtualenvs/gemma-U5bxnpzZ/lib/python3.11/site-packages/ai_edge_torch/lowertools/torch_xla_utils.py", line 29, in <module>
    from ai_edge_torch.lowertools import translate_recipe
  File "/home/scarlett/.local/share/virtualenvs/gemma-U5bxnpzZ/lib/python3.11/site-packages/ai_edge_torch/lowertools/translate_recipe.py", line 20, in <module>
    _ComputePrecision = quantizer.qtyping.ComputePrecision
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'ai_edge_quantizer.qtyping' has no attribute 'ComputePrecision'

Actual vs expected behavior:

Expected:
The library imports normally

Actual:
The library fails to import

Any other information you'd like to share?

Trying to use https://github.com/google-ai-edge/ai-edge-torch/blob/main/ai_edge_torch/generative/examples/gemma/convert_gemma2_to_tflite.py

@scarlettekk scarlettekk added the type:bug Bug label Sep 12, 2024
@pkgoogle pkgoogle self-assigned this Sep 16, 2024
@pkgoogle pkgoogle added the type:build/install Build and install issues label Sep 16, 2024
@pkgoogle
Copy link
Contributor

Hi @scarlettekk, how did you install the latest commit?

I was able to import properly the latest commit by doing this:

cd ai-edge-torch # my github root
git switch main # ensure you are on main branch
git pull # ensure you are up to date
pip install -e . # install the current code in your current environment, python=3.11 was previously installed
python
>>> import ai_edge_torch

Does this work if you start in a fresh environment? Thanks.

@pkgoogle pkgoogle added type:support For use-related issues status:awaiting user response When awaiting user response and removed type:bug Bug labels Sep 16, 2024
@patrickzan
Copy link

Hi @scarlettekk @pkgoogle, I also got the same error with python3.10 environment using the following approach, but when I switched to python3.11 and re-installed ai-edge-torch the same way, the error disappeared. Hope this is helpful.

cd ai-edge-torch # my github root
git switch main # ensure you are on main branch
git pull # ensure you are up to date
pip install -e . # install the current code in your current environment, python=3.11 was previously installed
python
>>> import ai_edge_torch

Copy link

Marking this issue as stale since it has been open for 7 days with no activity. This issue will be closed if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:awaiting user response When awaiting user response status:stale type:build/install Build and install issues type:support For use-related issues
Projects
None yet
Development

No branches or pull requests

3 participants