MCPcopy Create free account
hub / github.com/ChenWu98/agent-attack / VLM

Class VLM

agent_attack/util/interfaces.py:39–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37
38# === General VLM Inference Interface ===
39class VLM(Protocol):
40 image_processor: ImageProcessor
41
42 def load(self) -> Tuple[nn.Module, Tokenizer, ImageProcessor]:
43 ...
44
45 def get_prompt_builder(self, system_prompt: Optional[str] = None) -> Any:
46 ...
47
48 def get_prompt_fn(self, dataset_family: str = "vqa-v2") -> Callable[[str], str]:
49 ...
50
51 def generate_answer(
52 self,
53 pixel_values: torch.Tensor,
54 question_prompts: List[str],
55 return_string_probabilities: Optional[List[str]] = None,
56 ) -> Union[List[str], List[List[float]]]:
57 ...
58
59 def generate(
60 self,
61 image: Image,
62 input_text: str,
63 do_sample: bool,
64 temperature: float,
65 max_new_tokens: int,
66 min_length: int,
67 length_penalty: float,
68 **kwargs,
69 ) -> str:
70 ...

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected