-
Notifications
You must be signed in to change notification settings - Fork 50
Description
File "/root/anaconda3/envs/glm_swift/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) File "/data/xws/glm/diffusers-main/src/diffusers/pipelines/glm_image/pipeline_glm_image.py", line 636, in call prior_token_ids, prior_token_image_ids = self.generate_prior_tokens( File "/data/xws/glm/diffusers-main/src/diffusers/pipelines/glm_image/pipeline_glm_image.py", line 298, in generate_prior_tokens prior_token_image_embed = torch.cat(prior_token_image_embed, dim=0) TypeError: cat() received an invalid combination of arguments - got (BaseModelOutputWithPooling, dim=int), but expected one of: * (tuple of Tensors tensors, int dim = 0, *, Tensor out = None) * (tuple of Tensors tensors, name dim, *, Tensor out = None)
transformers: 5.0.1.dev0
diffusers: 0.37.0.dev0
请问是这两库的版本不兼容吗,以上均为按照您的流程中的
pip install git+https://github.com/huggingface/transformers.git
pip install git+https://github.com/huggingface/diffusers.git 安装
并且采用的是您提供的图生图脚本:import torch
from diffusers.pipelines.glm_image import GlmImagePipeline
from PIL import Image
pipe = GlmImagePipeline.from_pretrained("zai-org/GLM-Image", torch_dtype=torch.bfloat16, device_map="balanced")
image_path = "cond.jpg"
prompt = "Replace the background of the snow forest with an underground station featuring an automatic escalator."
image = Image.open(image_path).convert("RGB")
image = pipe(
prompt=prompt,
image=[image], # can input multiple images for multi-image-to-image generation such as [image, image1]
height=33 * 32, # Must set height even it is same as input image
width=32 * 32, # Must set width even it is same as input image
num_inference_steps=50,
guidance_scale=1.5,
generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
image.save("output_i2i.png")
唯一不同的是用了多卡推理device_map="balanced"。
期待您的回复,谢谢