Llava 完成
LlavaCompletionPack
基类:EventBaseLlamaPack
Llava 补全包。
workflows/handler.py 中的源代码llama_index/packs/llava_completion/base.py
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 | class LlavaCompletionPack(BaseLlamaPack):
"""Llava Completion pack."""
def __init__(
self,
image_url: str,
**kwargs: Any,
) -> None:
"""Init params."""
import os
if not os.environ.get("REPLICATE_API_TOKEN", None):
raise ValueError("Replicate API Token is missing or blank.")
self.image_url = image_url
self.llm = Replicate(
model="yorickvp/llava-13b:2facb4a474a0462c15041b78b1ad70952ea46b5ec6ad29583c0b29dbd4249591",
image=self.image_url,
)
def get_modules(self) -> Dict[str, Any]:
"""Get modules."""
return {
"llm": self.llm,
"image_url": self.image_url,
}
def run(self, *args: Any, **kwargs: Any) -> Any:
"""Run the pipeline."""
return self.llm.complete(*args, **kwargs)
|
get_modules
get_modules() -> Dict[str, Any]
获取模块。
workflows/handler.py 中的源代码llama_index/packs/llava_completion/base.py
| def get_modules(self) -> Dict[str, Any]:
"""Get modules."""
return {
"llm": self.llm,
"image_url": self.image_url,
}
|
run
run(*args: Any, **kwargs: Any) -> Any
运行流水线。
workflows/handler.py 中的源代码llama_index/packs/llava_completion/base.py
| def run(self, *args: Any, **kwargs: Any) -> Any:
"""Run the pipeline."""
return self.llm.complete(*args, **kwargs)
|
选项:
成员:- LlavaCompletionPack