Skip to content

Commit

Permalink
Stubs for dataloader
Browse files Browse the repository at this point in the history
  • Loading branch information
jloveric committed May 6, 2024
1 parent 6ef7979 commit 95dd4af
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
26 changes: 25 additions & 1 deletion examples/text_to_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

import pandas as pd
from sentence_transformers import SentenceTransformer
from PIL import Image
import numpy as np
import io




model = SentenceTransformer("all-MiniLM-L6-v2")

Expand All @@ -23,4 +29,22 @@
print("")

ans = pd.read_parquet("train-00000-of-00645-b66ac786bf6fb553.parquet")
print('ans', ans)
data = ans.iloc[0]

print('ans', data)
print(ans['caption'][0])
jpg_0 = ans['jpg_0'][0]
jpg_1 = ans['jpg_1'][0]

img = Image.open(io.BytesIO(jpg_0))
arr = np.asarray(img)
print('arr', arr)

"""
from torchdata.datapipes.iter import FileLister
import torcharrow.dtypes as dt
DTYPE = dt.Struct([dt.Field("Values", dt.int32)])
ource_dp = FileLister(".", masks="df*.parquet")
parquet_df_dp = source_dp.load_parquet_as_df(dtype=DTYPE)
list(parquet_df_dp)[0]
"""
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pytorch-lightning = "^2.1.3"
pandas = "^2.2.2"
fastparquet = "^2024.2.0"
sentence-transformers = "^2.7.0"
numpy = "^1.26.4"

[tool.poetry.dev-dependencies]
black = "^22.3.0"
Expand Down

0 comments on commit 95dd4af

Please sign in to comment.