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

[BUG] fix HNSW param defaults in new configuration logic & require batch_size < sync_threshold #2526

Merged
merged 8 commits into from
Jul 18, 2024

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented Jul 16, 2024

It doesn't really make sense to have a config where hnsw:batch_size > hnsw:sync_threshold, and although (I think) we don't depend on this invariant today we could accidentally depend on it in the future without enforcing it.

Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@codetheweb codetheweb changed the title [ENH] fix HNSW param defaults in new configuration logic [ENH] fix HNSW param defaults in new configuration logic & require batch_size < sync_threshold Jul 16, 2024

return configuration

return CollectionConfigurationInternal.from_json_str(json_str)
Copy link
Contributor Author

@codetheweb codetheweb Jul 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered making migrations a generic concept for CollectionConfigurations, but after starting to implement that it seemed like a lot of abstraction overhead for now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah let's punt on that

@codetheweb codetheweb marked this pull request as ready for review July 17, 2024 17:44
@codetheweb codetheweb requested a review from atroyn July 17, 2024 17:44
chromadb/api/configuration.py Outdated Show resolved Hide resolved
chromadb/api/configuration.py Outdated Show resolved Hide resolved
chromadb/api/configuration.py Outdated Show resolved Hide resolved
):
return (False, "batch_size must be less than or equal to sync_threshold")

return super().validator()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can just return nothing if we don't except, if we make this something which raises exceptions but otherwise does nothing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can probably take a parameter list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can probably take a parameter list?

sorry, what do you mean by this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right now this is an instance method that reads self.parameter_map but what we actually want is to see if a given parameter_list on creation corresponds to a valid configuration, similar to how ParameterValidator works for individual values.

This is mostly a stylistic choice though and I think it's fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, it does kinda make sense for it to be a static method but finding the params you want from the list would be a little annoying

chromadb/db/mixins/sysdb.py Outdated Show resolved Hide resolved
chromadb/db/mixins/sysdb.py Outdated Show resolved Hide resolved
@codetheweb codetheweb requested a review from atroyn July 17, 2024 21:30
Copy link
Contributor

@atroyn atroyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending nits

@atroyn atroyn changed the title [ENH] fix HNSW param defaults in new configuration logic & require batch_size < sync_threshold [BUG] fix HNSW param defaults in new configuration logic & require batch_size < sync_threshold Jul 17, 2024
@codetheweb codetheweb merged commit 25ae8e4 into main Jul 18, 2024
65 checks passed
@codetheweb codetheweb deleted the fix-hnsw-param-defaults branch July 18, 2024 00:11
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

Successfully merging this pull request may close these issues.

2 participants