Skip to content

Commit

Permalink
Working on text to image
Browse files Browse the repository at this point in the history
  • Loading branch information
jloveric committed May 6, 2024
1 parent 85bde1a commit 6ef7979
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions examples/text_to_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@
# This will be an image generator based on parquet data https://huggingface.co/datasets/yuvalkirstain/pickapic_v2/tree/main/data

import pandas as pd
from sentence_transformers import SentenceTransformer

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

# Our sentences we like to encode
sentences = [
"This framework generates embeddings for each input sentence",
"Sentences are passed as a list of string.",
"The quick brown fox jumps over the lazy dog.",
]

# Sentences are encoded by calling model.encode()
sentence_embeddings = model.encode(sentences)

# Print the embeddings
for sentence, embedding in zip(sentences, sentence_embeddings):
print("Sentence:", sentence)
print("Embedding:", len(embedding))
print("")

ans = pd.read_parquet("train-00000-of-00645-b66ac786bf6fb553.parquet")
print('ans', ans)
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ torchvision = "^0.16.2"
pytorch-lightning = "^2.1.3"
pandas = "^2.2.2"
fastparquet = "^2024.2.0"
sentence-transformers = "^2.7.0"

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

0 comments on commit 6ef7979

Please sign in to comment.