Skip to content

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

Open

Description

@omkar806

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/python@3.12/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

Activity

  1. phamson02 commented on Apr 23, 2024

    @phamson02
    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.

  2. omkar806 commented on Apr 23, 2024

    @omkar806
    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

  3. phamson02 commented on Apr 23, 2024

    @phamson02
    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

  4. omkar806 commented on Apr 25, 2024

    @omkar806
    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

  5. omkar806 commented on Apr 25, 2024

    @omkar806
    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")

  6. phamson02 commented on Apr 26, 2024

    @phamson02
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions