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

Installing Concordia on M1 Mac - TensorFlow-text does not seem to exist for M1 #37

Closed
anatoleg opened this issue Mar 22, 2024 · 10 comments
Assignees

Comments

@anatoleg
Copy link

Cannot install the gdm-concordia package on an M1 Mac either for Python3.11 or Python3.12. The PIP installer cannot find TensorFlow-text which, apparently, does not exist for M1 Macs. Is there any way around this?

@jagapiou
Copy link
Member

I think that dep is needed for the embedder, so until that dep works Concordia doesn't work on M1 macs.

If you can get by without an embedder, cb505d3 might help.
You can git clone our repo and pip install from there. That would also allow you to comment out anything else that doesn't work on M1 macs.

@jagapiou
Copy link
Member

jagapiou commented Mar 22, 2024

#34 adds an alternative embedder, so hopefully that will work soon.

See code snippet in #37 (comment).

@anatoleg
Copy link
Author

I assume that the embedder is needed to properly run the provided agent examples. Any chance for a gdm-concordia package release that can be PIP installed on M1 macs?

@jzleibo
Copy link
Collaborator

jzleibo commented Mar 22, 2024

There is a pull request under review right now which will solve this once it's fully incorporated.

@jagapiou
Copy link
Member

jagapiou commented Mar 27, 2024

You can use the following snippet on M1 macs if you install sentence_transformers:

@functools.cache
def embedder(model: str = 'sentence-transformers/sentence-t5-base'):
  return sentence_transformers.SentenceTransformer(model).encode

Thanks @wacunn for this workaround.

@jagapiou jagapiou self-assigned this Mar 27, 2024
@anatoleg
Copy link
Author

Thank you @jagapiou. What do I need to do to properly install Concordia instead of "pip install gdm-concordia" as recommended in README? Do I follow the manual install instructions and patch a file (which one)? Thanks again.

@jagapiou
Copy link
Member

jagapiou commented Mar 27, 2024

You can pip install directly from GitHub, or you can git clone it locally and pip install from there (the manual install instructions).

@anatoleg
Copy link
Author

Cloned the files and followed the manual install instructions. No installer complaints this time. But the code still blows up on "import tensorflow_text" in embedder_st5.py ("No module named tensorflow_text"). Not clear how to apply the suggested workaround. Should I use a different embedder? Which one? Thanks.

@wacunn
Copy link
Contributor

wacunn commented Mar 28, 2024

This is the code that I am using on an M1 Mac.

Setup sentence encoder

from sentence_transformers import SentenceTransformer
st5_model = SentenceTransformer('sentence-transformers/sentence-t5-base')
embedder = st5_model.encode

@anatoleg
Copy link
Author

That worked. I installed sentence_transformers and did not import embedder_st5 from concordia.associative_memory. Used your code instead. Thank you very much.

@jagapiou jagapiou pinned this issue Apr 2, 2024
@jagapiou jagapiou closed this as completed Apr 2, 2024
copybara-service bot pushed a commit that referenced this issue Apr 17, 2024
This will ensure the embedder works with M1-based macs (fixes #37).

PiperOrigin-RevId: 625611229
Change-Id: I6591565e82774e23aa40bd7a33571f8fe6a9a0d5
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

4 participants