Views
No views yet
pip install git+https://github.com/Abhinay1997/imscore@cyclereward1from imscore.cyclereward.model import CycleReward
2available_models = ["NagaSaiAbhinay/CycleReward-Combo" "NagaSaiAbhinay/CycleReward-T2I", "NagaSaiAbhinay/CycleReward-I2T"]
3model_id = available_models[0]
4model = CycleReward.from_pretrained(model_id)
5
6prompts = "a photo of a cat"
7pixels = Image.open("cat.jpg")
8pixels = np.array(pixels)
9pixels = rearrange(torch.tensor(pixels), "h w c -> 1 c h w") / 255.0
10
11# prompts and pixels should have the same batch dimension
12# pixels should be in the range [0, 1]
13# score == logits
14score = model.score(pixels, prompts) # full differentiable reward)