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

Pygemma not getting build on mac when I do it in virtual environment. #16

Open
omkar806 opened this issue Apr 23, 2024 · 6 comments
Open

Comments

@omkar806
Copy link

Collecting pygemma==0.1.3
Using cached pygemma-0.1.3.tar.gz (4.0 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pygemma
Building wheel for pygemma (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for pygemma (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [63 lines of output]
running bdist_wheel
running build
running build_ext
CMake Warning:
Ignoring extra path from command line:

     "/private/var/folders/_f/5wjn/T/pip-install-gi3rew2y/pygemma_682956"
  
  
  CMake Error: T"/opt/homebrew/Cellar/[email protected]/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 413, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', '/private/var/folders/_f/5w00gn/T/pip-install-gi3rew2y/pygemma_68a6', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/_f/5wjp0gn/T/pip-install-gi3rew2y/pygemma_6829ca6/build/lib.macosx-14.0-arm64-cpython-312', '-DPYTHON_EXECUTABLE=/Users/name/Documents/C++/venv/bin/python3.12']' returned non-zero exit status 1.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pygemma
Failed to build pygemma
ERROR: Could not build wheels for pygemma, which is required to install pyproject.toml-based projects

@phamson02
Copy link
Contributor

Can you try to install it from source as instructed here?

You can refer to this example file to see new APIs of the library.

@omkar806
Copy link
Author

yeah I tried building it from source , but when i ran it I got this error : Abort at /Users/username/Documents/pygemma/gemma-cpp-python-0.1.3/build/temp.macosx-14.0-arm64-cpython-312/_deps/gemma-src/gemma.cc:823: Failed to load the tokenizer file.
zsh: abort python test.py

@phamson02
Copy link
Contributor

Have you already built successfully? From the error message looks like maybe there is a problem with the tokenizer file you are using to load model

@omkar806
Copy link
Author

I built successfully now I also loaded the tokenizer but now I am gettting this error when I run the code?
tokenizer : [no path specified]
compressed_weights : [no path specified]
model :
weights : [no path specified]
max_tokens : 3072
max_generated_tokens : 2048
multiturn : 0
Failed to read cache c_embedding (error 381)
Abort at /Users/username/Documents/pygemma/gemma-cpp-python-0.1.3/build/temp.macosx-14.0-arm64-cpython-312/_deps/gemma-src/gemma.cc:113: Failed to open model file - does it exist?
zsh: abort python test.py
Note:gemma.cc file exists

@omkar806
Copy link
Author

My Code :
from pygemma import Gemma

gemma = Gemma()
gemma.show_help()
gemma.show_config()
gemma.load_model("/Users/username/Documents/pygemma/gemma_model/tokenizer.spm", "/Users/username/Documents/pygemma/gemma_model/2b-it-sfp.sbs", "2b-it-sfp")
gemma.completion("Write a poem")

@phamson02
Copy link
Contributor

If I am correct, you are still using the older version of pygemma. I'd recommend you to update to the lastest commits of the repo and rebuild, as it was tested and uses a newer version of gemma.cpp. Maybe the issue you are facing relates to that this version of pygemma was still using old version of gemma.cpp, which may not work with newer model files.

Here is the how you may use the new version of pygemma:

from pygemma import Gemma, ModelType, ModelTraining

gemma = Gemma(
    tokenizer_path=<TOKENIZER_PATH>,
    compressed_weights_path=<COMPRESSED_WEIGHTS_PATH>,
    model_type=ModelType.Gemma2B,
    model_training=ModelTraining.GEMMA_IT,
)

output = gemma("Write a poem")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants