Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ from PIL import Image
|
|
| 4 |
from torchvision import transforms, models
|
| 5 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 6 |
import pandas as pd
|
|
|
|
| 7 |
import random
|
| 8 |
import urllib.parse
|
| 9 |
import torch.nn as nn
|
|
@@ -85,7 +86,8 @@ optimizer = torch.optim.Adam(model_resnet.parameters(), lr=0.001, weight_decay=1
|
|
| 85 |
scheduler = ReduceLROnPlateau(optimizer, mode='min', factor=0.5, patience=3, verbose=True)
|
| 86 |
|
| 87 |
# Load GPT-Neo and CLIP
|
| 88 |
-
model_clip, preprocess_clip =
|
|
|
|
| 89 |
model_clip.eval()
|
| 90 |
|
| 91 |
model_name = "EleutherAI/gpt-neo-1.3B"
|
|
|
|
| 4 |
from torchvision import transforms, models
|
| 5 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 6 |
import pandas as pd
|
| 7 |
+
import open_clip
|
| 8 |
import random
|
| 9 |
import urllib.parse
|
| 10 |
import torch.nn as nn
|
|
|
|
| 86 |
scheduler = ReduceLROnPlateau(optimizer, mode='min', factor=0.5, patience=3, verbose=True)
|
| 87 |
|
| 88 |
# Load GPT-Neo and CLIP
|
| 89 |
+
model_clip, preprocess_clip = open_clip.create_model_and_transforms('ViT-B/32', device=device)
|
| 90 |
+
tokenizer_clip = open_clip.get_tokenizer('ViT-B/32')
|
| 91 |
model_clip.eval()
|
| 92 |
|
| 93 |
model_name = "EleutherAI/gpt-neo-1.3B"
|