fix import module of LlamaVision and JoyCaption2 nodes
This commit is contained in:
@@ -3,9 +3,7 @@ import sys
|
||||
import torch
|
||||
import torch.amp.autocast_mode
|
||||
from torch import nn
|
||||
from transformers import AutoModel, AutoProcessor, AutoTokenizer, PreTrainedTokenizer, PreTrainedTokenizerFast, AutoModelForCausalLM
|
||||
from typing import List, Union
|
||||
import torchvision.transforms.functional as TVF
|
||||
from PIL import Image
|
||||
|
||||
import folder_paths
|
||||
@@ -67,7 +65,8 @@ class ImageAdapter(nn.Module):
|
||||
return self.other_tokens(torch.tensor([2], device=self.other_tokens.weight.device)).squeeze(0)
|
||||
|
||||
def load_models(model_path, dtype, vlm_lora, device):
|
||||
|
||||
from transformers import AutoModel, AutoProcessor, AutoTokenizer, PreTrainedTokenizer, PreTrainedTokenizerFast, \
|
||||
AutoModelForCausalLM
|
||||
from peft import PeftModel
|
||||
|
||||
use_lora = True if vlm_lora != "none" else False
|
||||
@@ -247,6 +246,7 @@ def stream_chat(input_images: List[Image.Image], caption_type: str, caption_leng
|
||||
|
||||
# For debugging
|
||||
print(f"Prompt: {prompt_str}")
|
||||
import torchvision.transforms.functional as TVF
|
||||
|
||||
for i in range(0, len(input_images), batch_size):
|
||||
batch = input_images[i:i + batch_size]
|
||||
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
# Based on https://github.com/SeanScripts/ComfyUI-PixtralLlamaMolmoVision
|
||||
import os
|
||||
from transformers import MllamaForConditionalGeneration, AutoProcessor, GenerationConfig, StopStringCriteria, set_seed
|
||||
|
||||
import comfy.model_management as mm
|
||||
import folder_paths
|
||||
|
||||
@@ -44,6 +44,8 @@ class LS_LlamaVision:
|
||||
def llama_vision(self, image, model, system_prompt, user_prompt, max_new_tokens, do_sample, temperature,
|
||||
top_p, top_k, stop_strings, seed, include_prompt_in_output, cache_model,):
|
||||
|
||||
from transformers import MllamaForConditionalGeneration, AutoProcessor, GenerationConfig, StopStringCriteria, set_seed
|
||||
|
||||
device = mm.get_torch_device()
|
||||
if self.previous_model is not None:
|
||||
llama_vision_model = self.previous_model
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui_layerstyle"
|
||||
description = "A set of nodes for ComfyUI it generate image like Adobe Photoshop's Layer Style. the Drop Shadow is first completed node, and follow-up work is in progress."
|
||||
version = "1.0.74"
|
||||
version = "1.0.75"
|
||||
license = "MIT"
|
||||
dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "scikit_learn", "opencv-contrib-python", "pymatting", "segment_anything", "timm", "addict", "yapf", "colour-science", "wget", "mediapipe", "loguru", "typer_config", "fastapi", "rich", "google-generativeai", "diffusers", "omegaconf", "tqdm", "transformers", "kornia", "image-reward", "ultralytics", "blend_modes", "blind-watermark", "qrcode", "pyzbar", "transparent-background", "huggingface_hub", "accelerate", "bitsandbytes", "torchscale", "wandb", "hydra-core", "psd-tools", "inference-cli[yolo-world]", "inference-gpu[yolo-world]", "onnxruntime", "peft"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user