Datawhale AI夏令营第四期 魔搭-AIGC方向 Task2:精读代码,实战进阶 笔记

在夏令营第四期Task1时,我们已经跑通了baseline,本期目的是对baseline的代码有一个更加细致的理解,学习如何借助AI来提升我们的自学习能力,理解每行代码的意思,从大模型提问技巧来实现自主学习,并学习如何制作一个连环画。

首先认识大语言模型(通义千问)

        通义千问是具有信息查询、语言理解、文本创作等多能力的AI助手。我们可以看到,编程与技术支持能力是它的强项之一。

精读baseline——从零入门AI生图

                                                             baseline实例代码

!pip install simple-aesthetics-predictor
 
!pip install -v -e data-juicer
 
!pip uninstall pytorch-lightning -y
!pip install peft lightning pandas torchvision
 
!pip install -e DiffSynth-Studio
 
from modelscope.msdatasets import MsDataset
 
ds = MsDataset.load(
    'AI-ModelScope/lowres_anime',
    subset_name='default',
    split='train',
    cache_dir="/mnt/workspace/kolors/data"
)
 
import json, os
from data_juicer.utils.mm_utils import SpecialTokens
from tqdm import tqdm
 
 
os.makedirs("./data/lora_dataset/train", exist_ok=True)
os.makedirs("./data/data-juicer/input", exist_ok=True)
with open("./data/data-juicer/input/metadata.jsonl", "w") as f:
    for data_id, data in enumerate(tqdm(ds)):
        image = data["image"].convert("RGB")
        image.save(f"/mnt/workspace/kolors/data/lora_dataset/train/{data_id}.jpg")
        metadata = {"text": "二次元", "image": [f"/mnt/workspace/kolors/data/lora_dataset/train/{data_id}.jpg"]}
        f.write(json.dumps(metadata))
        f.write("\n")
 
data_juicer_config = """
# global parameters
project_name: 'data-process'
dataset_path: './data/data-juicer/input/metadata.jsonl'  # path to your dataset directory or file
np: 4  # number of subprocess to process your dataset
text_keys: 'text'
image_key: 'image'
image_special_token: '<__dj__image>'
export_path: './data/data-juicer/output/result.jsonl'
# process schedule
# a list of several process operators with their arguments
process:
    - image_shape_filter:
        min_width: 1024
        min_height: 1024
        any_or_all: any
    - image_aspect_ratio_filter:
        min_ratio: 0.5
        max_ratio: 2.0
        any_or_all: any
"""
with open("data/data-juicer/data_juicer_config.yaml", "w") as file:
    file.write(data_juicer_config.strip())
 
!dj-process --config data/data-juicer/data_juicer_config.yaml
 
import pandas as pd
import os, json
from PIL import Image
from tqdm import tqdm
 
 
texts, file_names = [], []
os.makedirs("./data/data-juicer/output/images", exist_ok=True)
with open("./data/data-juicer/output/result.jsonl", "r") as f:
    for line in tqdm(f):
        metadata = json.loads(line)
        texts.append(metadata["text"])
        file_names.append(metadata["image"][0])
 
df = pd.DataFrame({"text": texts, "file_name": file_names})
df.to_csv("./data/data-juicer/output/result.csv", index=False)
 
df
 
from transformers import CLIPProcessor, CLIPModel
import torch
 
model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
 
images = [Image.open(img_path) for img_path in df["file_name"]]
inputs = processor(text=df["text"].tolist(), images=images, return_tensors="pt", padding=True)
 
outputs = model(**inputs)
logits_per_image = outputs.logits_per_image  # this is the image-text similarity score
probs = logits_per_image.softmax(dim=1)  # we can take the softmax to get the probabilities
 
probs
 
from torch.utils.data import Dataset, DataLoader
 
class CustomDataset(Dataset):
    def __init__(self, df, processor):
        self.texts = df["text"].tolist()
        self.images = [Image.open(img_path) for img_path in df["file_name"]]
        self.processor = processor
 
    def __len__(self):
        return len(self.texts)
 
    def __getitem__(self, idx):
        inputs = self.processor(text=self.texts[idx], images=self.images[idx], return_tensors="pt", padding=True)
        return inputs
 
dataset = CustomDataset(df, processor)
dataloader = DataLoader(dataset, batch_size=8)
 
for batch in dataloader:
    outputs = model(**batch)
    logits_per_image = outputs.logits_per_image
    probs = logits_per_image.softmax(dim=1)
    print(probs)
 
import torch
from diffusers import StableDiffusionPipeline
 
torch.manual_seed(1)
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v-1-4", torch_dtype=torch.float16)
pipe = pipe.to("cuda")
 
prompt = "二次元,一个紫色长发小女孩穿着粉色吊带漏肩连衣裙,在练习室练习唱歌,手持话筒"
negative_prompt = "丑陋、变形、嘈杂、模糊、低对比度"
guidance_scale = 4
num_inference_steps = 50
 
image = pipe(
    prompt=prompt,
    negative_prompt=negative_prompt,
    guidance_scale=guidance_scale,
    num_inference_steps=num_inference_steps,
    height=1024,
    width=1024,
).images[0]
 
image.save("example_image.png")
image
 
from PIL import Image
 
torch.manual_seed(1)
image = pipe(
    prompt="二次元,日系动漫,演唱会的观众席,人山人海,一个紫色短发小女孩穿着粉色吊带漏肩连衣裙坐在演唱会的观众席,舞台上衣着华丽的歌星们在唱歌",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("1.jpg")
 
torch.manual_seed(1)
image = pipe(
    prompt="二次元,一个紫色短发小女孩穿着粉色吊带漏肩连衣裙坐在演唱会的观众席,露出憧憬的神情",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度,色情擦边",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("2.jpg")
 
torch.manual_seed(2)
image = pipe(
    prompt="二次元,一个紫色短发小女孩穿着粉色吊带漏肩连衣裙坐在演唱会的观众席,露出憧憬的神情",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度,色情擦边",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("3.jpg")
 
torch.manual_seed(5)
image = pipe(
    prompt="二次元,一个紫色短发小女孩穿着粉色吊带漏肩连衣裙,对着流星许愿,闭着眼睛,十指交叉,侧面",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度,扭曲的手指,多余的手指",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("4.jpg")
 
torch.manual_seed(0)
image = pipe(
    prompt="二次元,一个紫色中等长度头发小女孩穿着粉色吊带漏肩连衣裙,在练习室练习唱歌",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("5.jpg")
 
torch.manual_seed(1)
image = pipe(
    prompt="二次元,一个紫色长发小女孩穿着粉色吊带漏肩连衣裙,在练习室练习唱歌,手持话筒",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("6.jpg")
 
torch.manual_seed(7)
image = pipe(
    prompt="二次元,紫色长发少女,穿着黑色连衣裙,试衣间,心情忐忑",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("7.jpg")
 
torch.manual_seed(0)
image = pipe(
    prompt="二次元,紫色长发少女,穿着黑色礼服,连衣裙,在台上唱歌",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("8.jpg")
 
import numpy as np
from PIL import Image
 
 
images = [np.array(Image.open(f"{i}.jpg")) for i in range(1, 9)]
image = np.concatenate([
    np.concatenate(images[0:2], axis=1),
    np.concatenate(images[2:4], axis=1),
    np.concatenate(images[4:6], axis=1),
    np.concatenate(images[6:8], axis=1),
], axis=0)
image = Image.fromarray(image).resize((1024, 2048))
image

是一个优秀的python开发工程师,现在我们需要你帮我们分析这个代码的主体框架,你需要把代码按照工作流分成几部分,用中文回答我的问题。{此处替换前面的代码}

用上面的语言输入到通义千问对话框中,用来提问

再次提问,逐行代码解析

你是一个优秀的python开发工程师,现在我们需要你帮我们逐行分析这个代码,用中文回答我的问题。{此处替换前面的代码}


你是一个优秀的python开发工程师,现在我们需要你帮我们逐行分析这个代码,用中文回答我的问题。{!pip install simple-aesthetics-predictor

!pip install -v -e data-juicer

!pip uninstall pytorch-lightning -y
!pip install peft lightning pandas torchvision

!pip install -e DiffSynth-Studio

from modelscope.msdatasets import MsDataset

ds = MsDataset.load(
    'AI-ModelScope/lowres_anime',
    subset_name='default',
    split='train',
    cache_dir="/mnt/workspace/kolors/data"
)

import json, os
from data_juicer.utils.mm_utils import SpecialTokens
from tqdm import tqdm


os.makedirs("./data/lora_dataset/train", exist_ok=True)
os.makedirs("./data/data-juicer/input", exist_ok=True)
with open("./data/data-juicer/input/metadata.jsonl", "w") as f:
    for data_id, data in enumerate(tqdm(ds)):
        image = data["image"].convert("RGB")
        image.save(f"/mnt/workspace/kolors/data/lora_dataset/train/{data_id}.jpg")
        metadata = {"text": "二次元", "image": [f"/mnt/workspace/kolors/data/lora_dataset/train/{data_id}.jpg"]}
        f.write(json.dumps(metadata))
        f.write("\n")

data_juicer_config = """
# global parameters
project_name: 'data-process'
dataset_path: './data/data-juicer/input/metadata.jsonl'  # path to your dataset directory or file
np: 4  # number of subprocess to process your dataset

text_keys: 'text'
image_key: 'image'
image_special_token: '<__dj__image>'

export_path: './data/data-juicer/output/result.jsonl'

# process schedule
# a list of several process operators with their arguments
process:
    - image_shape_filter:
        min_width: 1024
        min_height: 1024
        any_or_all: any
    - image_aspect_ratio_filter:
        min_ratio: 0.5
        max_ratio: 2.0
        any_or_all: any
"""
with open("data/data-juicer/data_juicer_config.yaml", "w") as file:
    file.write(data_juicer_config.strip())

!dj-process --config data/data-juicer/data_juicer_config.yaml

import pandas as pd
import os, json
from PIL import Image
from tqdm import tqdm


texts, file_names = [], []
os.makedirs("./data/data-juicer/output/images", exist_ok=True)
with open("./data/data-juicer/output/result.jsonl", "r") as f:
    for line in tqdm(f):
        metadata = json.loads(line)
        texts.append(metadata["text"])
        file_names.append(metadata["image"][0])

df = pd.DataFrame({"text": texts, "file_name": file_names})
df.to_csv("./data/data-juicer/output/result.csv", index=False)

df

from transformers import CLIPProcessor, CLIPModel
import torch

model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")

images = [Image.open(img_path) for img_path in df["file_name"]]
inputs = processor(text=df["text"].tolist(), images=images, return_tensors="pt", padding=True)

outputs = model(**inputs)
logits_per_image = outputs.logits_per_image  # this is the image-text similarity score
probs = logits_per_image.softmax(dim=1)  # we can take the softmax to get the probabilities

probs

from torch.utils.data import Dataset, DataLoader

class CustomDataset(Dataset):
    def __init__(self, df, processor):
        self.texts = df["text"].tolist()
        self.images = [Image.open(img_path) for img_path in df["file_name"]]
        self.processor = processor

    def __len__(self):
        return len(self.texts)

    def __getitem__(self, idx):
        inputs = self.processor(text=self.texts[idx], images=self.images[idx], return_tensors="pt", padding=True)
        return inputs

dataset = CustomDataset(df, processor)
dataloader = DataLoader(dataset, batch_size=8)

for batch in dataloader:
    outputs = model(**batch)
    logits_per_image = outputs.logits_per_image
    probs = logits_per_image.softmax(dim=1)
    print(probs)

import torch
from diffusers import StableDiffusionPipeline

torch.manual_seed(1)
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v-1-4", torch_dtype=torch.float16)
pipe = pipe.to("cuda")

prompt = "二次元,一个紫色长发小女孩穿着粉色吊带漏肩连衣裙,在练习室练习唱歌,手持话筒"
negative_prompt = "丑陋、变形、嘈杂、模糊、低对比度"
guidance_scale = 4
num_inference_steps = 50

image = pipe(
    prompt=prompt,
    negative_prompt=negative_prompt,
    guidance_scale=guidance_scale,
    num_inference_steps=num_inference_steps,
    height=1024,
    width=1024,
).images[0]

image.save("example_image.png")
image

from PIL import Image

torch.manual_seed(1)
image = pipe(
    prompt="二次元,日系动漫,演唱会的观众席,人山人海,一个紫色短发小女孩穿着粉色吊带漏肩连衣裙坐在演唱会的观众席,舞台上衣着华丽的歌星们在唱歌",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("1.jpg")

torch.manual_seed(1)
image = pipe(
    prompt="二次元,一个紫色短发小女孩穿着粉色吊带漏肩连衣裙坐在演唱会的观众席,露出憧憬的神情",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度,色情擦边",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("2.jpg")

torch.manual_seed(2)
image = pipe(
    prompt="二次元,一个紫色短发小女孩穿着粉色吊带漏肩连衣裙坐在演唱会的观众席,露出憧憬的神情",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度,色情擦边",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("3.jpg")

torch.manual_seed(5)
image = pipe(
    prompt="二次元,一个紫色短发小女孩穿着粉色吊带漏肩连衣裙,对着流星许愿,闭着眼睛,十指交叉,侧面",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度,扭曲的手指,多余的手指",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("4.jpg")

torch.manual_seed(0)
image = pipe(
    prompt="二次元,一个紫色中等长度头发小女孩穿着粉色吊带漏肩连衣裙,在练习室练习唱歌",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("5.jpg")

torch.manual_seed(1)
image = pipe(
    prompt="二次元,一个紫色长发小女孩穿着粉色吊带漏肩连衣裙,在练习室练习唱歌,手持话筒",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("6.jpg")

torch.manual_seed(7)
image = pipe(
    prompt="二次元,紫色长发少女,穿着黑色连衣裙,试衣间,心情忐忑",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("7.jpg")

torch.manual_seed(0)
image = pipe(
    prompt="二次元,紫色长发少女,穿着黑色礼服,连衣裙,在台上唱歌",
    negative_prompt="丑陋、变形、嘈杂、模糊、低对比度",
    cfg_scale=4,
    num_inference_steps=50, height=1024, width=1024,
)
image.save("8.jpg")

import numpy as np
from PIL import Image


images = [np.array(Image.open(f"{i}.jpg")) for i in range(1, 9)]
image = np.concatenate([
    np.concatenate(images[0:2], axis=1),
    np.concatenate(images[2:4], axis=1),
    np.concatenate(images[4:6], axis=1),
    np.concatenate(images[6:8], axis=1),
], axis=0)
image = Image.fromarray(image).resize((1024, 2048))
image
}

好的,让我们逐行分析这段代码:

1. 环境设置与依赖安装
!pip install simple-aesthetics-predictor: 安装simple-aesthetics-predictor包。
!pip install -v -e data-juicer: 以可编辑模式安装data-juicer包,并显示详细的安装信息。
!pip uninstall pytorch-lightning -y: 卸载pytorch-lightning包。
!pip install peft lightning pandas torchvision: 安装peft, lightning, pandas, 和 torchvision包。
!pip install -e DiffSynth-Studio: 以可编辑模式安装DiffSynth-Studio包。
2. 数据集加载与处理
from modelscope.msdatasets import MsDataset: 导入ModelScope的数据集模块。
ds = MsDataset.load(...) : 从ModelScope加载名为lowres_anime的数据集,并选择default子集,训练集split='train',缓存目录设为/mnt/workspace/kolors/data。
3. 图像与元数据保存
os.makedirs("./data/lora_dataset/train", exist_ok=True): 创建目录./data/lora_dataset/train,如果已存在则不报错。
os.makedirs("./data/data-juicer/input", exist_ok=True): 创建目录./data/data-juicer/input,如果已存在则不报错。
with open(...) as f:: 打开文件./data/data-juicer/input/metadata.jsonl用于写入元数据。
循环遍历数据集中的每一条数据:
image = data["image"].convert("RGB"): 将图片转换为RGB模式。
image.save(...): 将图片保存到指定路径。
metadata = {...}: 创建元数据字典,包含文本标签"二次元"以及图片路径。
f.write(json.dumps(metadata)): 将元数据序列化为JSON字符串,并写入文件。
f.write("\n"): 在每一行元数据之后添加换行符。
4. 配置data-juicer并运行数据处理
data_juicer_config = ...: 定义data-juicer的配置字符串,包括项目名、数据路径、文本键、图片键、特殊标记、导出路径以及过滤规则。
with open(...) as file:: 打开文件data/data-juicer/data_juicer_config.yaml并将配置字符串写入。
!dj-process --config data/data-juicer/data_juicer_config.yaml: 运行data-juicer处理数据,使用之前定义的配置文件。
5. 处理过滤后的数据
texts, file_names = [], []: 初始化两个列表,用于存储文本和文件名。
os.makedirs("./data/data-juicer/output/images", exist_ok=True): 创建目录./data/data-juicer/output/images,如果已存在则不报错。
读取处理后的结果文件./data/data-juicer/output/result.jsonl:
metadata = json.loads(line): 解析每一行的JSON字符串为Python字典。
texts.append(metadata["text"]): 将文本添加到列表中。
file_names.append(metadata["image"][0]): 将图片路径添加到列表中。
df = pd.DataFrame({...}): 创建Pandas DataFrame,列包括"text"和"file_name"。
df.to_csv(...): 将DataFrame保存为CSV文件。
df: 显示DataFrame的内容。
6. 使用CLIP模型计算相似度
from transformers import CLIPProcessor, CLIPModel: 导入CLIP模型和处理器。
model = CLIPModel.from_pretrained(...): 加载预训练的CLIP模型。
processor = CLIPProcessor.from_pretrained(...): 加载预训练的CLIP处理器。
读取DataFrame中的所有图片,并使用CLIP处理器处理文本和图片。
outputs = model(**inputs): 使用CLIP模型计算输出。
logits_per_image = outputs.logits_per_image: 获取图像-文本相似度得分。
probs = logits_per_image.softmax(dim=1): 计算概率分布。
probs: 显示概率分布。
7. 自定义数据集类与数据加载
class CustomDataset(Dataset):: 定义自定义数据集类。
def __init__(self, df, processor):: 构造函数初始化数据集。
def __len__(self):: 返回数据集中样本的数量。
def __getitem__(self, idx):: 获取指定索引的样本。
dataset = CustomDataset(df, processor): 创建数据集实例。
dataloader = DataLoader(dataset, batch_size=8): 创建数据加载器。
循环遍历数据加载器中的批次,并使用CLIP模型计算相似度得分和概率分布。
8. 使用Stable Diffusion生成图像
import torch: 导入PyTorch。
from diffusers import StableDiffusionPipeline: 导入Stable Diffusion管道。
设置随机种子以确保生成图像的一致性。
pipe = StableDiffusionPipeline.from_pretrained(...): 加载预训练的Stable Diffusion模型。
pipe = pipe.to("cuda"): 将模型移动到CUDA设备上。
使用不同的提示和负向提示生成图像,并保存到磁盘。
9. 合并生成的图像
import numpy as np: 导入NumPy。
读取生成的图像,并将它们按顺序拼接在一起形成一幅大图。
调整大小并显示最终的图像。
以上就是对这段代码的逐行分析。如果你有任何具体的问题或者需要进一步的解释,请随时告诉我!

我再次追问 我对其中{替换成你的问题}还是不太理解,给我再详细介绍一下

我对其中{image = pipe(
    prompt=prompt,
    negative_prompt=negative_prompt,
    guidance_scale=guidance_scale,
    num_inference_steps=num_inference_steps,
    height=1024,
    width=1024,
).images[0]}还是不太理解,给我再详细介绍一下

当然可以。这一段代码涉及使用StableDiffusionPipeline来生成图像。让我们仔细看一下这段代码:

Python
深色版本
image = pipe(
    prompt=prompt,
    negative_prompt=negative_prompt,
    guidance_scale=guidance_scale,
    num_inference_steps=num_inference_steps,
    height=1024,
    width=1024,
).images[0]
1. pipe
pipe 是一个 StableDiffusionPipeline 实例,它是一个用于文本到图像生成的深度学习模型。在这个例子中,pipe 已经被加载并移动到了 CUDA 设备上。

2. prompt
这是生成图像的文本提示。例如:
prompt = "二次元,一个紫色长发小女孩穿着粉色吊带漏肩连衣裙,在练习室练习唱歌,手持话筒"

Python
深色版本
prompt = "二次元,一个紫色长发小女孩穿着粉色吊带漏肩连衣裙,在练习室练习唱歌,手持话筒"
这行代码告诉模型要生成一个符合该描述的图像。

3. negative_prompt
这是负面提示,用来指导模型避免生成某些特征。例如:
negative_prompt = "丑陋、变形、嘈杂、模糊、低对比度"

Python
深色版本
negative_prompt = "丑陋、变形、嘈杂、模糊、低对比度"
这行代码告诉模型生成的图像不应包含负面提示中提到的特征。

4. guidance_scale
这是指导比例(Guidance Scale),用来控制生成图像与文本提示之间的相关性。较高的值会使生成的图像更紧密地遵循文本提示,而较低的值则会生成更多样化的图像。

5. num_inference_steps
这是生成过程中的迭代步数。更多的步骤通常会导致更高的图像质量,但同时也会增加计算时间。

6. height 和 width
这是生成图像的目标高度和宽度,单位是像素。

7. .images[0]
pipe 方法返回一个字典,其中包含生成的图像。.images 是这个字典的一个键,其对应的值是一个包含生成图像的列表。由于我们通常只需要一张图像,因此这里使用 [0] 来获取第一个(也是唯一的)生成图像。

总结
这段代码调用 pipe 对象的 __call__ 方法来生成图像。它使用给定的提示和参数来创建图像。最后通过 .images[0] 获取生成的第一张图像,并将其赋值给变量 image。

如果你想要查看生成的图像,可以使用 display 函数或者直接保存到文件中。例如:
from IPython.display import display

display(image)

from IPython.display import display

display(image)
或者保存到文件中:
image.save("generated_image.png")


image.save("generated_image.png")
这样就可以看到生成的图像了。如果你想要我帮助生成这些图像的示例,请告诉我,我可以为你生成一些示例图像。


 

实战演练一一基于话剧的连环画制作

数据准备
用通义千问生成提示词

自己在通义给出的提示词基础上,多多调整,争取打磨出最佳的提示词

回到磨塔社区,执行Task1的30分钟速通Baseline

魔搭社区 (modelscope.cn)

提示词修改
  • 双击进入baseline文件

  • 找到生成图像的板块

  • 依次替换8张图片的正向提示词和反向提示词

  • 21
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值