Datasets:

Formats:
parquet
Languages:
English
ArXiv:
Tags:
image
Libraries:
Datasets
Dask
License:
PD12M / tutorials /embeddings.md
Nick Padgett
Adding small lines for embeddings.
a9b60c5
|
raw
history blame
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]