Update README.md
Browse files
README.md
CHANGED
|
@@ -2,9 +2,55 @@
|
|
| 2 |
tags:
|
| 3 |
- model_hub_mixin
|
| 4 |
- pytorch_model_hub_mixin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
tags:
|
| 3 |
- model_hub_mixin
|
| 4 |
- pytorch_model_hub_mixin
|
| 5 |
+
license: mit
|
| 6 |
+
datasets:
|
| 7 |
+
- carolineec/CyclePrefDB-I2T
|
| 8 |
+
language:
|
| 9 |
+
- en
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Model Card for CycleReward-I2T
|
| 13 |
+
|
| 14 |
+
[Project page](https://cyclereward.github.io) | [Paper](https://huggingface.co/papers/2506.02095) | [Code](https://github.com/hjbahng/cyclereward)
|
| 15 |
+
|
| 16 |
+
Reward model for image-text alignment trained on image-to-text comparison pairs from [CyclePrefDB-I2T](https://huggingface.co/datasets/carolineec/CyclePrefDB-I2T).
|
| 17 |
+
|
| 18 |
+
This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration.
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
## Loading the model
|
| 22 |
+
|
| 23 |
+
Download the `model.py`, `med_config.json` files and `blip` folder from this repository. You can load the pretrained model using the code below:
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
```
|
| 27 |
+
import torch
|
| 28 |
+
from PIL import Image
|
| 29 |
+
from model import CycleReward
|
| 30 |
+
|
| 31 |
+
device='cuda'
|
| 32 |
+
model = CycleReward.from_pretrained("carolineec/CycleReward-I2T")
|
| 33 |
+
model.to(device)
|
| 34 |
+
model.eval()
|
| 35 |
+
|
| 36 |
+
preprocess = model.preprocess
|
| 37 |
+
image_path = "cat.jpg"
|
| 38 |
+
caption = "a photo of a cat"
|
| 39 |
+
image = preprocess(Image.open(image_path)).unsqueeze(0).to(device)
|
| 40 |
+
print('prepared data')
|
| 41 |
+
|
| 42 |
+
score = model.score(image, caption)
|
| 43 |
+
print('my score:', score.item())
|
| 44 |
+
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
## Citation
|
| 48 |
+
|
| 49 |
+
```
|
| 50 |
+
@article{bahng2025cyclereward,
|
| 51 |
+
title={Cycle Consistency as Reward: Learning Image-Text Alignment without Human Preferences},
|
| 52 |
+
author= {Bahng, Hyojin and Chan, Caroline and Durand, Fredo and Isola, Phillip},
|
| 53 |
+
journal={arXiv preprint arXiv:2506.02095},
|
| 54 |
+
year={2025}
|
| 55 |
+
}
|
| 56 |
+
```
|