mobileclip2_coca_dfn2b_s13b_docci_s12m_context256
5
2.0B
—
by
apple
Other
OTHER
2B params
New
5 downloads
Early-stage
Edge AI:
Mobile
Laptop
Server
5GB+ RAM
Mobile
Laptop
Server
Quick Summary
MobileCLIP2: Improving Multi-Modal Reinforced Training MobileCLIP2 was introduced in MobileCLIP2: Improving Multi-Modal Reinforced Training (TMLR August 2025 F...
Device Compatibility
Mobile
4-6GB RAM
Laptop
16GB RAM
Server
GPU
Minimum Recommended
2GB+ RAM
Code Examples
pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)pythonpytorch
import torch
import open_clip
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('coca_ViT-L-14', pretrained='/path/to/mobileclip2_coca.pt')
model.eval()
image = preprocess(Image.open("docs/fig_accuracy_latency.png").convert('RGB')).unsqueeze(0)
with torch.no_grad(), torch.cuda.amp.autocast():
syn_text = model.generate(
image,
generation_type="top_p",
top_p=0.9,
fixed_output_length=True
)[0]
syn_text = open_clip.decode(syn_text).split("<end_of_text>")[0].split("<start_of_text>")[-1].split(".")[0].rstrip()
print("Caption:", syn_text)Deploy This Model
Production-ready deployment in minutes
Together.ai
Instant API access to this model
Production-ready inference API. Start free, scale to millions.
Try Free APIReplicate
One-click model deployment
Run models in the cloud with simple API. No DevOps required.
Deploy NowDisclosure: We may earn a commission from these partners. This helps keep LLMYourWay free.