Datasets:
|
Download tutorials/embeddings.md from Spawning/PD12M: direct link, hf CLI and curl.
- Browser
- Download file 744 Bytes
-
https://huggingface.co/datasets/Spawning/PD12M/resolve/main/tutorials/embeddings.md
- Command line
-
hf download hf://datasets/Spawning/PD12M/tutorials/embeddings.md
-
curl -L -o embeddings.md https://huggingface.co/datasets/Spawning/PD12M/resolve/main/tutorials/embeddings.md
744 Bytes
| # Working with the embeddings | |
| The embeddings are available as numpy files, where each row is a 768-dimension floating point embedding. Each row is associated with it's matching index in the metadata files. | |
| #### Open an embedding file | |
| The files are in numpy format, and can be opened with `numpy` in Python. | |
| ```python | |
| import numpy as np | |
| embeddings = np.load('pd12m.01.npy') | |
| ``` | |
| #### Join Embeddings to Metadata | |
| If you already have the metadata files loaded with pandas, you can join the embeddings to the dataframe simply. | |
| ```python | |
| df["embeddings"] = embeddings.tolist() | |
| ``` | |
| Alternatively, you could use a 0-based index to access both the metadata and associated embedding. | |
| ```python | |
| i = 300 | |
| metadata = df.iloc[i] | |
| embedding = embeddings[i] | |