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

Tutorial webpage does not match jupyter notebooks #2

Open
aubreyyan opened this issue Aug 23, 2024 · 1 comment
Open

Tutorial webpage does not match jupyter notebooks #2

aubreyyan opened this issue Aug 23, 2024 · 1 comment

Comments

@aubreyyan
Copy link

aubreyyan commented Aug 23, 2024

Consistently, the website with the tutorials instructs users to create an index in postgresql using the access method lantern_hnsw.
image
This is directly contradicted by the jupyter notebooks in https://github.com/lanterndata/examples/tree/main
image
And it is unclear which, if any, is correct.

After following the tutorials, neither access method works for me.

# python3 setup_embeddings.py
INFO:root:Connecting to ourdb on localhost:5432
INFO:root:Table movies does not exist, creating it
INFO:root:Found 3883 embeddings with dimensionality 32
INFO:root:Creating L2 Norm index on movies
Traceback (most recent call last):
  File "/root/projects/lantern_movie_recommender/setup_embeddings.py", line 42, in <module>
    ourdb.execute(f"CREATE INDEX ON {constants.MOVIES_TABLE_NAME} USING lantern_hnsw (vector dist_l2sq_ops) WITH (dim={dimensions});")
psycopg2.errors.UndefinedObject: access method "lantern_hnsw" does not exist
# python3 setup_embeddings.py
INFO:root:Connecting to ourdb on localhost:5432
INFO:root:Table movies does not exist, creating it
INFO:root:Found 3883 embeddings with dimensionality 32
INFO:root:Creating L2 Norm index on movies
Traceback (most recent call last):
  File "/root/projects/lantern_movie_recommender/setup_embeddings.py", line 46, in <module>
    ourdb.execute(f"CREATE INDEX ON {constants.MOVIES_TABLE_NAME} USING hnsw (vector dist_l2sq_ops) WITH (dim={dimensions});")
psycopg2.errors.UndefinedObject: access method "hnsw" does not exist

to reproduce, feel free to reference my source code. https://github.com/aubreyyan/lantern_movie_recommender

@dqii
Copy link
Contributor

dqii commented Aug 27, 2024

Hi! Sorry for these issues and thanks for letting us know.

lantern_hnsw is the correct access method. I just made these changes.

I also simplified the docs to use Lantern Cloud URLs for simplicity, although the self-hosting instructions still work.

Your issue with lantern_hnsw seems to be that the Lantern extension isn't loaded in the database.

In your setup.sh, can you change

sudo -i -u postgres psql -U postgres -c 'CREATE EXTENSION lantern'

to

sudo -i -u postgres psql -U postgres -d ourdb -c 'CREATE EXTENSION lantern'

I believe that should fix your error.

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