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

Anonymous indices #230

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions nomic/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ def get_map(self, name: str = None, atlas_index_id: str = None, projection_id: s

def create_index(
self,
name: str,
name: str = None,
indexed_field: str = None,
colorable_fields: list = [],
multilingual: bool = False,
Expand All @@ -982,7 +982,7 @@ def create_index(
Creates an index in the specified project.

Args:
name: The name of the index and the map.
name: The name of the index and the map. Defaults to a number
indexed_field: For text projects, name the data field corresponding to the text to be mapped.
colorable_fields: The project fields you want to be able to color by on the map. Must be a subset of the projects fields.
multilingual: Should the map take language into account? If true, points from different languages but semantically similar text are close together.
Expand All @@ -1003,7 +1003,8 @@ def create_index(
'''

self._latest_project_state()

if name is None:
name = f"Index #{1 + len(self.indices)}"
# for large projects, alter the default projection configurations.
if self.total_datums >= 1_000_000:
if (
Expand Down Expand Up @@ -1279,8 +1280,9 @@ def add_embeddings(
del data

# Add embeddings to the data.
embeddings = embeddings.astype(np.float16)

# Allow 2d embeddings to stay at single-fp precision.
if not (embeddings.shape[1] == 2 and embeddings.dtype == np.float32):
embeddings = embeddings.astype(np.float16)
# Fail if any embeddings are NaN or Inf.
assert not np.isnan(embeddings).any(), "Embeddings must not contain NaN values."
assert not np.isinf(embeddings).any(), "Embeddings must not contain Inf values."
Expand Down