mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-10 06:10:50 +08:00
15 lines
522 B
Python
15 lines
522 B
Python
import torch
|
|
|
|
from comfy_extras.nodes.nodes_language import TransformersLoader, OneShotInstructTokenize
|
|
|
|
|
|
def test_integration_transformers_loader_and_tokenize():
|
|
loader = TransformersLoader()
|
|
tokenize = OneShotInstructTokenize()
|
|
|
|
model, = loader.execute("llava-hf/llava-v1.6-mistral-7b-hf", "")
|
|
tokens, = tokenize.execute(model, "Describe this image:", torch.rand((1, 224, 224, 3)), "llava-v1.6-mistral-7b-hf", )
|
|
|
|
assert isinstance(tokens, dict)
|
|
assert "input_ids" in tokens or "inputs" in tokens
|