Downloads · 30 days
4
7% of all-time downloads
yeeaa/UNIT_600M
UNIT_600M is a machine learning model from yeeaa. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This project supports both NVIDIA and Ascend GPUs.
Downloads · 30 days
4
7% of all-time downloads
All-time downloads
55
Public
Repo size
2.6 GB
Likes
0
Public
Click a slice to open those files.
.bin1.3 GB · 100%
From the Hugging Face model README
pip install torch==2.1.0
pip install timm==0.9.12
pip install transformers==4.32.1
This project supports both NVIDIA and Ascend GPUs.
import torch
from PIL import Image
from transformers import CLIPImageProcessor
from unit import UNITModel
model_path = "/path/to/UNIT_600M/"
model = UNITModel.from_pretrained(model_path)
model.to(device='cuda')
model.eval()
image_processor = CLIPImageProcessor.from_pretrained(model_path)
image = Image.open("test.jpg").convert('RGB')
image_input = image_processor(image)['pixel_values'][0]
image_tensor = torch.tensor(image_input).unsqueeze(0).to(torch.bfloat16).cuda()
with torch.set_grad_enabled(False):
cls_tokens, spatial_tokens = model(image_tensor)