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

lightrag.py and lightrag_ollama_demo.py dimensions are inconsistent. Make dimensions a global constant for consistency #503

Open
s-github-2 opened this issue Dec 23, 2024 · 1 comment

Comments

@s-github-2
Copy link

Default values for v1.0.7 are inconsistent so was getting errors.
Fix was to change lightrag.py line 145 "dimensions" to 768 from the default 1536 to run the lightrag_ollama_demo..py on windows 11 machine with nividia rtx gpu.
Suggest making dimensions parameter for default_factory line 145 in lightrag.py a global constant that can be used by the demo files . Was getting errors that went away once I made this change and made default dimensions in the example and the lightrag.py consistent

@blakkd
Copy link

blakkd commented Dec 25, 2024

Just a global share to everyone: The dimension isn't equal to the context length (I don't say this for you @s-github-2 ;)).

You can find the dimension as [...].embedding_length, n_embd, or even hidden_size probably among others:

  • in the config.json (eg. in the HF repo)
  • in the Ollama model page (clicking on model to expand all the properties)

Or any other place providing those details :)

For example, Snowflake/snowflake-arctic-embed-l-v2.0 has:
A context length (=max_tokens=num_ctx, etc.) of 8192 and a dimension of 1024.

They aren't linked, as you can see with this other example:
mixedbread-ai/mxbai-embed-large-v1 has:
A context length of 512 (max_position_embeddings here) but a dimension of 1024 too.

To make it tidier, you can already memorize this:

Context Length

  • max_tokens
  • num_ctx
  • max_position_embeddings

Dimension

  • embedding_length
  • n_embd
  • hidden_size

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