Skip to content

Does the reward_dim parameter actually do anything? #24

@KZF-kzf

Description

@KZF-kzf

I’ve noticed that whether I set it to dim1, dim2, or overall_detail, the output values remain exactly the same.
my code

import torch
from EditReward import EditRewardInferencer

CHECKPOINT_PATH = "EditReward-MiMo-VL-7B-SFT-2508"
CONFIG_PATH = "EditReward/config/EditReward-MiMo-VL-7B-SFT-2508.yaml"

_inferencer = None


def _get_inferencer(dim):
    global _inferencer
    if _inferencer is None:
        _inferencer = EditRewardInferencer(
            config_path=CONFIG_PATH,
            checkpoint_path=CHECKPOINT_PATH,
            device="cuda" if torch.cuda.is_available() else "cpu",
            reward_dim=dim,
        )
    return _inferencer


def compute_editreward_score(src_path: str, tgt_path: str, instruction: str, dim) -> float:
    inferencer = _get_inferencer(dim)
    with torch.no_grad():
        rewards = inferencer.reward(
            prompts=[instruction],
            image_src=[src_path],
            image_paths=[tgt_path]
        )
    print(rewards)
    print(dim)
    return rewards[0][0].item()


if __name__ == "__main__":
    img_src = "22_source.png"
    img_tgt = "22.png"
    prompt = "在古董车打开的行李箱里添加一只坐着的小棕狗。"
    score = compute_editreward_score(img_src, img_tgt, prompt, dim="dim1")
    print(f"EditReward result: {score:.4f}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions