Skip to content

Commit

Permalink
update version to 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nreimers committed Oct 1, 2021
1 parent ffd72ab commit afee883
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
37 changes: 34 additions & 3 deletions examples/applications/image-search/example.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
from sentence_transformers import SentenceTransformer, util
from PIL import Image
from sentence_transformers import SentenceTransformer, util, models
from PIL import ImageFile, Image
import numpy as np
import requests




###########

image = Image.open('two_dogs_in_snow.jpg')

from transformers import CLIPProcessor, CLIPModel

model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")



inputs = processor(texts=["a cat", "a dog"], images=[image], return_tensors="pt", padding=True)
output = model(**inputs)
#vision_outputs = model.vision_model(pixel_values=inputs['pixel_values'])
#image_embeds = model.visual_projection(vision_outputs[1])

#print(image_embeds.shape)
#exit()



#Load CLIP model
model = SentenceTransformer('clip-ViT-B-32')
clip = models.CLIPModel()
model = SentenceTransformer(modules=[clip])

model.save('tmp-clip-model')

model = SentenceTransformer('tmp-clip-model')

#Encode an image:
img_emb = model.encode(Image.open('two_dogs_in_snow.jpg'))
Expand Down
2 changes: 1 addition & 1 deletion sentence_transformers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.0.0"
__version__ = "2.1.0"
__MODEL_HUB_ORGANIZATION__ = 'sentence-transformers'
from .datasets import SentencesDataset, ParallelSentencesDataset
from .LoggingHandler import LoggingHandler
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="sentence-transformers",
version="2.0.0",
version="2.1.0",
author="Nils Reimers",
author_email="info@nils-reimers.de",
description="Sentence Embeddings using BERT / RoBERTa / XLM-R",
Expand Down

0 comments on commit afee883

Please sign in to comment.