MCPcopy Index your code
hub / github.com/XPixelGroup/DiffBIR / __init__

Method __init__

diffbir/utils/caption.py:154–164  ·  view source on GitHub ↗
(self, device: torch.device)

Source from the content-addressed store, hash-verified

152class RAMCaptioner(Captioner):
153
154 def __init__(self, device: torch.device) -> Captioner:
155 super().__init__(device)
156 image_size = 384
157 transform = get_transform(image_size=image_size)
158 pretrained = "https://huggingface.co/xinyu1205/recognize-anything-plus-model/resolve/main/ram_plus_swin_large_14m.pth"
159 model = ram_plus(pretrained=pretrained, image_size=image_size, vit="swin_l")
160 model.eval()
161 model = model.to(device)
162
163 self.transform = transform
164 self.model = model
165
166 def __call__(self, image: Image.Image) -> str:
167 image = self.transform(image).unsqueeze(0).to(self.device)

Callers

nothing calls this directly

Calls 3

get_transformFunction · 0.90
ram_plusFunction · 0.90
__init__Method · 0.45

Tested by

no test coverage detected