MusIre commited on
Commit
d2cf9ed
·
verified ·
1 Parent(s): b7c2afa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -3,7 +3,7 @@ from PIL import Image
3
  from torchvision import transforms, models
4
  from transformers import AutoModelForCausalLM, AutoTokenizer
5
  import pandas as pd
6
- import open_clip
7
  import random
8
  import urllib.parse
9
  import torch.nn as nn
@@ -84,11 +84,8 @@ model_resnet = DualOutputResNet(num_styles, num_artists).to(device)
84
  optimizer = torch.optim.Adam(model_resnet.parameters(), lr=0.001, weight_decay=1e-5)
85
  scheduler = ReduceLROnPlateau(optimizer, mode='min', factor=0.5, patience=3, verbose=True)
86
 
87
- # Load GPT-Neo and CLIP
88
- model_clip = open_clip.create_model('ViT-B/32', pretrained='openai').to(device)
89
- preprocess_clip = open_clip.image_transform((224, 224), is_train=False)
90
- tokenizer_clip = open_clip.get_tokenizer('ViT-B/32')
91
- model_clip.eval()
92
 
93
  model_name = "EleutherAI/gpt-neo-1.3B"
94
  tokenizer = AutoTokenizer.from_pretrained(model_name)
 
3
  from torchvision import transforms, models
4
  from transformers import AutoModelForCausalLM, AutoTokenizer
5
  import pandas as pd
6
+ from sentence_transformers import SentenceTransformer
7
  import random
8
  import urllib.parse
9
  import torch.nn as nn
 
84
  optimizer = torch.optim.Adam(model_resnet.parameters(), lr=0.001, weight_decay=1e-5)
85
  scheduler = ReduceLROnPlateau(optimizer, mode='min', factor=0.5, patience=3, verbose=True)
86
 
87
+ # Load SentenceTransformer model
88
+ clip_model = SentenceTransformer('sentence-transformers/clip-ViT-B-32-multilingual-v1').to(device)
 
 
 
89
 
90
  model_name = "EleutherAI/gpt-neo-1.3B"
91
  tokenizer = AutoTokenizer.from_pretrained(model_name)