allenai / unified-io-2.pytorch

Apache License 2.0
61 stars 1 forks source link

The output of the largest model seems unreliable. #3

Open MufanColin opened 6 months ago

MufanColin commented 6 months ago

We are running the XXL Unified IO 2 model (pytorch version) on a NVIDIA GeForce RTX 4090. The demo.py file is shown below:

from uio2 import config
from uio2.model import UnifiedIOModel
from uio2.preprocessing import UnifiedIOPreprocessor
preprocessor = UnifiedIOPreprocessor.from_config(config.XXL, "tokenizer.model")
model = UnifiedIOModel(config.XXL)

from uio2.runner import TaskRunner
runner = TaskRunner(model, preprocessor)

for _ in range(3):
    ans1 = runner.categorization("something.jpg", ["boy", "girl", "cat", "dog", "car", "plane", "sun"])
    print(f"Prediction: {ans1}")

something.jpg file is actually a picture of cat. something

The output is shown below:

Prediction: sun
Prediction: sun
Prediction: sun

Are we doing anything wrong?

shubhamagarwal92 commented 3 months ago

I guess config.XXL model initialized the model from scratch. Maybe try

preprocessor = UnifiedIOPreprocessor.from_pretrained("allenai/uio2-preprocessor", tokenizer="/path/to/tokenizer")
model = UnifiedIOModel.from_pretrained("allenai/uio2-large")