diff --git a/2-sft_vlm.py b/2-sft_vlm.py deleted file mode 100644 index 877b76a..0000000 --- a/2-sft_vlm.py +++ /dev/null @@ -1,264 +0,0 @@ -import os -import platform -import argparse -import time -import math -import warnings -import json - -import pandas as pd -import torch -import torch.nn.functional as F -import torch.distributed as dist -from contextlib import nullcontext - -from torch import optim -from torch.nn.parallel import DistributedDataParallel -from torch.utils.data import DataLoader, DistributedSampler -from transformers import AutoTokenizer, AutoModel -from model.model import Transformer -from model.LMConfig import LMConfig -from model.dataset import SFTDataset, SFTDataset_multi -from model.vision_utils import get_vision_model, get_img_embedding - -warnings.filterwarnings('ignore') - - -def count_parameters(model): - return sum(p.numel() for p in model.parameters() if p.requires_grad) - - -def Logger(content): - if not ddp or dist.get_rank() == 0: - print(content) - - -def get_lr(it, all): - warmup_iters = args.warmup_iters - lr_decay_iters = all - min_lr = args.learning_rate / 10 - - if it < warmup_iters: - return args.learning_rate * it / warmup_iters - if it > lr_decay_iters: - return min_lr - decay_ratio = (it - warmup_iters) / (lr_decay_iters - warmup_iters) - assert 0 <= decay_ratio <= 1 - coeff = 0.5 * (1.0 + math.cos(math.pi * decay_ratio)) - return min_lr + coeff * (args.learning_rate - min_lr) - - -def train_epoch(epoch, wandb): - start_time = time.time() - for step, (X, Y, loss_mask, image_process) in enumerate(train_loader): - X = X.to(args.device) - Y = Y.to(args.device) - loss_mask = loss_mask.to(args.device) - image_process = image_process.to(args.device) - image_encoders = get_img_embedding(image_process, vision_model) - lr = get_lr(epoch * iter_per_epoch + step, args.epochs * iter_per_epoch) - for param_group in optimizer.param_groups: - param_group['lr'] = lr - - with ctx: - logits = model(X, Y, image_encoders=image_encoders).logits - loss = F.cross_entropy(logits.view(-1, logits.size(-1)), Y.view(-1), ignore_index=0, reduction='none') - loss_mask = loss_mask.view(-1) - loss = torch.sum(loss * loss_mask) / loss_mask.sum() - - scaler.scale(loss).backward() - - if (step + 1) % args.accumulation_steps == 0: - scaler.unscale_(optimizer) - torch.nn.utils.clip_grad_norm_(model.parameters(), args.grad_clip) - - scaler.step(optimizer) - scaler.update() - - optimizer.zero_grad(set_to_none=True) - - if step % args.log_interval == 0: - spend_time = time.time() - start_time - Logger( - 'Epoch:[{}/{}]({}/{}) loss:{:.3f} lr:{:.7f} epoch_Time:{}min:'.format( - epoch, - args.epochs, - step, - iter_per_epoch, - loss.item(), - optimizer.param_groups[-1]['lr'], - spend_time / (step + 1) * iter_per_epoch // 60 - spend_time // 60)) - - if (wandb is not None) and (not ddp or dist.get_rank() == 0): - wandb.log({"loss": loss, - "lr": optimizer.param_groups[-1]['lr'], - "epoch_Time": spend_time / (step + 1) * iter_per_epoch // 60 - spend_time // 60}) - - if (step + 1) % args.save_interval == 0 and (not ddp or dist.get_rank() == 0): - model.eval() - moe_path = '_moe' if lm_config.use_moe else '' - if args.multi: # 多图训练权重保存 - ckp = f'{args.save_dir}/{lm_config.dim}{moe_path}_vlm_sft_multi.pth' - else: # 单图训练权重保存 - ckp = f'{args.save_dir}/{lm_config.dim}{moe_path}_vlm_sft.pth' - - if isinstance(model, torch.nn.parallel.DistributedDataParallel): - state_dict = model.module.state_dict() - else: - state_dict = model.state_dict() - - torch.save(state_dict, ckp) - model.train() - if args.save_last and (not ddp or dist.get_rank() == 0) and args.multi: - model.eval() - moe_path = '_moe' if lm_config.use_moe else '' - ckp = f'{args.save_dir}/{lm_config.dim}{moe_path}_vlm_sft_multi.pth' - - if isinstance(model, torch.nn.parallel.DistributedDataParallel): - state_dict = model.module.state_dict() - else: - state_dict = model.state_dict() - - torch.save(state_dict, ckp) - model.train() - - -def init_model(lm_config): - tokenizer = AutoTokenizer.from_pretrained('./model/minimind_tokenizer') - moe_path = '_moe' if lm_config.use_moe else '' - - # 多图推理建议在单图推理之后 - if args.multi: - ckp = f'./out/{lm_config.dim}{moe_path}_vlm_sft.pth' - else: - ckp = f'./out/{lm_config.dim}{moe_path}_vlm_pretrain.pth' - - model = Transformer(lm_config) - state_dict = torch.load(ckp, map_location=args.device) - - # 处理不需要的前缀 - unwanted_prefix = '_orig_mod.' - for k, v in list(state_dict.items()): - if k.startswith(unwanted_prefix): - state_dict[k[len(unwanted_prefix):]] = state_dict.pop(k) - - # 加载到模型中 - model.load_state_dict(state_dict, strict=False) - model = model.to(args.device) - - print(f'模型可学习参数: {count_parameters(model) / 1e6} 百万 = {count_parameters(model) / 1e9} B (Billion)') - - (vision_model, preprocess) = get_vision_model(args.visual_encoder) - vision_model = vision_model.to(args.device) - return model, tokenizer, (vision_model, preprocess) - - -def init_distributed_mode(): - if not ddp: return - global ddp_local_rank, DEVICE - - dist.init_process_group(backend="nccl") - ddp_rank = int(os.environ["RANK"]) - ddp_local_rank = int(os.environ["LOCAL_RANK"]) - ddp_world_size = int(os.environ["WORLD_SIZE"]) - DEVICE = f"cuda:{ddp_local_rank}" - torch.cuda.set_device(DEVICE) - - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description="MiniMind-V-SFT") - parser.add_argument("--out_dir", type=str, default="out", help="Output directory") - parser.add_argument("--epochs", type=int, default=19, help="Number of epochs") - parser.add_argument("--batch_size", type=int, default=32, help="Batch size") - parser.add_argument("--learning_rate", type=float, default=1e-6, help="Learning rate") - parser.add_argument("--device", type=str, default="cuda:0" if torch.cuda.is_available() else "cpu", - help="Device to use") - parser.add_argument("--dtype", type=str, default="bfloat16", help="Data type") - parser.add_argument("--use_wandb", default=False, action="store_true", help="Use Weights & Biases") - parser.add_argument("--wandb_project", type=str, default="MiniMind-V", help="Weights & Biases project name") - parser.add_argument("--num_workers", type=int, default=8, help="Number of workers for data loading") - parser.add_argument("--data_path", type=str, default="./dataset/LLaVA-Instruct/llava_instruct_230k.json", - help="Path to training data") - parser.add_argument("--data_path_multi", type=str, default="./dataset/sft_multi_images/output.json", - help="Path to multi images training data") - parser.add_argument("--ddp", action="store_true", help="Use DistributedDataParallel") - parser.add_argument("--accumulation_steps", type=int, default=1, help="Gradient accumulation steps") - parser.add_argument("--grad_clip", type=float, default=1.0, help="Gradient clipping threshold") - parser.add_argument("--warmup_iters", type=int, default=0, help="Number of warmup iterations") - parser.add_argument("--log_interval", type=int, default=100, help="Logging interval") - parser.add_argument("--save_interval", type=int, default=100, help="Model saving interval") - parser.add_argument('--local_rank', type=int, default=-1, help='local rank for distributed training') - parser.add_argument('--multi', type=bool, default=False, help='multi-images training') - parser.add_argument('--save_last', type=bool, default=True, help='save last step model') - parser.add_argument('--visual_encoder', type=str, default="clip", help='type of visual endcoder') - - args = parser.parse_args() - - if args.visual_encoder == "clip": - lm_config = LMConfig() - else: - lm_config = LMConfig(image_special_token='<' * 98 + '>' * 98, image_ids=[30] * 98 + [32] * 98) - - max_seq_len = lm_config.max_seq_len - args.save_dir = os.path.join(args.out_dir) - os.makedirs(args.save_dir, exist_ok=True) - os.makedirs(args.out_dir, exist_ok=True) - tokens_per_iter = args.batch_size * max_seq_len - torch.manual_seed(1337) - device_type = "cuda" if "cuda" in args.device else "cpu" - - args.wandb_run_name = f"MiniMind-V-SFT-Epoch-{args.epochs}-BatchSize-{args.batch_size}-LearningRate-{args.learning_rate}" - - ctx = nullcontext() if device_type == "cpu" else torch.cuda.amp.autocast() - ddp = int(os.environ.get("RANK", -1)) != -1 # is this a ddp run? - ddp_local_rank, DEVICE = 0, "cuda:0" - if ddp: - init_distributed_mode() - args.device = torch.device(DEVICE) - - if args.use_wandb and (not ddp or ddp_local_rank == 0): - import wandb - - wandb.init(project=args.wandb_project, name=args.wandb_run_name) - else: - wandb = None - - model, tokenizer, (vision_model, preprocess) = init_model(lm_config) - - use_version = 0 - if args.multi: - print("进行多图训练,建议在指令微调后进行...") - train_ds = SFTDataset_multi(args.data_path_multi, tokenizer, vision_model=(vision_model, preprocess), - image_special_token=lm_config.image_special_token, - max_length=max_seq_len) - else: - train_ds = SFTDataset(args.data_path, tokenizer, vision_model=(vision_model, preprocess), - image_special_token=lm_config.image_special_token, - max_length=max_seq_len) - train_sampler = DistributedSampler(train_ds) if ddp else None - train_loader = DataLoader( - train_ds, - batch_size=args.batch_size, - pin_memory=True, - drop_last=False, - shuffle=False, - num_workers=args.num_workers, - sampler=train_sampler - ) - - scaler = torch.cuda.amp.GradScaler(enabled=(args.dtype in ['float16', 'bfloat16'])) - optimizer = optim.Adam(model.parameters(), lr=args.learning_rate) - - if False and not lm_config.use_moe and platform.system() != 'Windows' and float( - torch.__version__.split('.')[0]) >= 2: - Logger("compiling the model... (takes a ~minute)") - unoptimized_model = model - model = torch.compile(model) - - if ddp: - model._ddp_params_and_buffers_to_ignore = {"pos_cis"} - model = DistributedDataParallel(model, device_ids=[ddp_local_rank]) - - iter_per_epoch = len(train_loader) - for epoch in range(args.epochs): - train_epoch(epoch, wandb) diff --git a/3-eval_chat.py b/3-eval_chat.py deleted file mode 100644 index 52cb898..0000000 --- a/3-eval_chat.py +++ /dev/null @@ -1,149 +0,0 @@ -import os -import random -import numpy as np -import torch -import warnings -from PIL import Image -from transformers import AutoTokenizer, AutoModelForCausalLM -from model.model import Transformer -from model.LMConfig import LMConfig -from model.vision_utils import get_vision_model, get_img_process, get_img_embedding - -warnings.filterwarnings('ignore') - - -def count_parameters(model): - return sum(p.numel() for p in model.parameters() if p.requires_grad) - - -def init_model(lm_config, device, multi): - tokenizer = AutoTokenizer.from_pretrained('./model/minimind_tokenizer') - model_from = 1 # 1从权重,2用transformers - - if model_from == 1: - moe_path = '_moe' if lm_config.use_moe else '' - if multi: - ckp = f'./out/{lm_config.dim}{moe_path}_vlm_sft_multi.pth' - else: - ckp = f'./out/{lm_config.dim}{moe_path}_vlm_sft.pth' - model = Transformer(lm_config) - state_dict = torch.load(ckp, map_location=device) - - # 处理不需要的前缀 - unwanted_prefix = '_orig_mod.' - for k, v in list(state_dict.items()): - if k.startswith(unwanted_prefix): - state_dict[k[len(unwanted_prefix):]] = state_dict.pop(k) - model.load_state_dict(state_dict, strict=False) - else: - model = AutoModelForCausalLM.from_pretrained('minimind-v-v1-small', trust_remote_code=True) - - model = model.to(device) - print(f'模型参数: {count_parameters(model) / 1e6} 百万 = {count_parameters(model) / 1e9} B (Billion)') - - vision_model, preprocess = get_vision_model(encoder_type="clip") - vision_model = vision_model.to(device) - return model, tokenizer, vision_model, preprocess - - -def setup_seed(seed): - random.seed(seed) - np.random.seed(seed) - torch.manual_seed(seed) - torch.cuda.manual_seed(seed) - torch.cuda.manual_seed_all(seed) - torch.backends.cudnn.deterministic = True - torch.backends.cudnn.benchmark = False - - -if __name__ == "__main__": - # -------------------------- 基本参数设置 ----------------------------------- - multi = False # 设置multi参数,控制单图或多图推理 - out_dir = 'out' - temperature = 0.5 - top_k = 8 - setup_seed(1337) - device = 'cuda:0' if torch.cuda.is_available() else 'cpu' - dtype = 'bfloat16' - max_seq_len = 1024 - encoder_type = "clip" - # lm_config = LMConfig() - if encoder_type == "clip": - lm_config = LMConfig() - else: - lm_config = LMConfig(image_special_token='<' * 98 + '>' * 98, image_ids=[30] * 98 + [32] * 98) - lm_config.max_seq_len = max_seq_len - model, tokenizer, vision_model, preprocess = init_model(lm_config, device, multi) - model.eval() - - # -------------------------- 问题和目录设置 ----------------------------------- - if multi: - image_dir = './dataset/eval_multi_images/bird/' - prompt = f"{lm_config.image_special_token}\n{lm_config.image_special_token}\nName all the differences between these two birds." - else: - image_dir = './dataset/eval_images/' - prompt = lm_config.image_special_token + '\n这个图片描述的是什么内容?' - - image_files = sorted(os.listdir(image_dir)) - - # -------------------------- 推理逻辑 ----------------------------------- - if multi: - # 多图推理:所有图像编码一次性推理 - image_encoders = [] - for image_file in image_files: - image_path = os.path.join(image_dir, image_file) - image = Image.open(image_path).convert('RGB') - image_process = get_img_process(image, preprocess).to(vision_model.device) - image_encoder = get_img_embedding(image_process, vision_model).unsqueeze(0) - image_encoders.append(image_encoder) - print(f'[Image]: {image_file}') - image_encoders = torch.cat(image_encoders, dim=0).unsqueeze(0) - - messages = [{"role": "user", "content": prompt}] - new_prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)[ - -(max_seq_len - 1):] - x = tokenizer(new_prompt).data['input_ids'] - x = torch.tensor(x, dtype=torch.long, device=device)[None, ...] - - with torch.no_grad(): - res_y = model.generate(x, tokenizer.eos_token_id, max_new_tokens=max_seq_len, temperature=temperature, - top_k=top_k, stream=True, image_encoders=image_encoders) - print('[A]: ', end='') - history_idx = 0 - for y in res_y: - answer = tokenizer.decode(y[0].tolist()) - if answer and answer[-1] == '�': - y = next(res_y) - continue - print(answer[history_idx:], end='', flush=True) - history_idx = len(answer) - print('\n') - - else: - # 单图推理:对每张图像单独推理 - for image_file in image_files: - image_path = os.path.join(image_dir, image_file) - image = Image.open(image_path).convert('RGB') - image_process = get_img_process(image, preprocess).to(vision_model.device) - image_encoder = get_img_embedding(image_process, vision_model).unsqueeze(0) - - messages = [{"role": "user", "content": prompt}] - new_prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)[ - -(max_seq_len - 1):] - x = tokenizer(new_prompt).data['input_ids'] - x = torch.tensor(x, dtype=torch.long, device=device)[None, ...] - - print(f'[Image]: {image_file}') - with torch.no_grad(): - res_y = model.generate(x, tokenizer.eos_token_id, max_new_tokens=max_seq_len, temperature=temperature, - top_k=top_k, stream=True, image_encoders=image_encoder) - print('[A]: ', end='') - history_idx = 0 - for y in res_y: - answer = tokenizer.decode(y[0].tolist()) - if answer and answer[-1] == '�': - y = next(res_y) - continue - print(answer[history_idx:], end='', flush=True) - history_idx = len(answer) - print('\n') \ No newline at end of file diff --git a/README.md b/README.md index 6e5c0b8..b71fa2d 100644 --- a/README.md +++ b/README.md @@ -26,195 +26,224 @@ -* 本开源项目旨在从0开始,最快3小时训练一个小参数量的,具备视觉模态能力的语言模型**MiniMind-V** -* **MiniMind-V**同样极其轻量,最小版本体积仅为 GPT3 的约 $\frac{1}{7000}$,力求做到个人GPU也可快速推理甚至训练。 -* 这不仅是一个开源模型的实现,也是入门视觉语言模型(VLM)的教程。 -* 希望此项目能为研究者提供一个抛砖引玉的入门示例,帮助大家快速上手并对VLM领域产生更多的探索与创新。 +* 此项目旨在从0开始,仅用3块钱成本 + 2小时!即可训练出26M参数的超小多模态视觉语言模型**MiniMind-V**。 +* **MiniMind-V**最小版本体积仅为 GPT3 的约 $\frac{1}{7000}$,力求做到个人GPU也可快速推理甚至训练。 +* **MiniMind-V**是[MiniMind](https://github.com/jingyaogong/minimind)纯语言模型的视觉能力额外拓展。 +* 项目同时包含了VLM大模型的极简结构、数据集清洗、预训练(Pretrain)、监督微调(SFT)等全过程代码。 +* 这不仅是一个开源VLM模型的最小实现,也是入门视觉语言模型的简明教程。 +* 希望此项目能为所有人提供一个抛砖引玉的示例,一起感受创造的乐趣!推动更广泛AI社区的进步! - > 为防止误读,「从0开始」特指基于纯语言模型MiniMind(这是一个完全从0训练的类GPT模型)做进一步的,从0到1的视觉能力拓展。 - > 若需详细了解后者,请参考孪生项目[MiniMind](https://github.com/jingyaogong/minimind)。 +> 为防止误解,“2小时” 基于NVIDIA 3090硬件设备(单卡)测试`1 epoch`,“3块钱” 指GPU服务器租用成本。 - > 为防止误读,「最快3小时」是指您需要具备>本人硬件配置的机器,具体规格的详细信息将在下文提供。 -
| 图片 | -512_pretrain | -512_sft | -768_pretrain | -768_sft | +MiniMind2-V | +MiniMind2-V-Small | |
|---|---|---|---|---|---|---|---|
![]() |
- 头发和化妆,我喜欢她的自然头发! | -这个图片描绘了一个年轻的女人,她穿着一套西装,戴着一条领带,这表明她可能正在参加一个特别的时装活动或庆祝活动。 | -人为出演员的冒险片。 | -这个图片描绘了一个女人的肖像,她穿着一件粉红色的裙子。 | +
+
+
+ |
+ 图中是一个繁忙的城市街道,一条长长的街道两旁都是高楼大厦。这条街上挤满了汽车、卡车和公共汽车,还有许多其他车辆在路上行驶。在街道上,可以看到许多汽车,有的在高速行驶,而其他的则停在街道一侧。此外还有一辆公交车也停在街道的右侧。街道上可以看到交通灯,表明这是一个繁忙的城市环境。 | +图中是一个繁忙的城市景象,有几辆汽车和一辆卡车行驶在城市街道上。可以看到许多交通信号灯,其中一些位于街道左侧,另一些则在右侧。可以看到有几个人在街上行走,其中一些人站得离街道更近一些,而另一些则距离较远。还有一个停车标志位于画面的左侧,暗示着城市环境。可以看到街道上有两辆汽车,一辆在右边,另一辆在左边,还有一辆在左边。这幅图像捕捉到了都市环境中典型的一天。 |
![]() |
- 水中的化石, 一个由环绕的环形化石团组成的静止线. | -图片显示一只大型的 octopus, 一个大型的 octopus, 可能是一个潜在的海洋生物, 它在水面上, 或在海洋中 。 | -海星和触角。 | -图片显示了海星在海滩上,包括海星,以及一个水下物体。 | +
+
+
+ |
+ 图片显示了一个宇航员的宇航员身穿宇航服,坐在一架大型航天飞机上。他们似乎正在进行一次宇航员登机或下机的旅程。在宇航员的身后,有一个火箭发射架,可能是用来支撑宇航员在旅程中的任务。此外,还有一架飞机停在机库附近,进一步表明这是一次航空展。在飞机的周围,还有一些人,但他们看起来离飞机很近。可以看到一个人站在飞机附近,可能正在观察或等待航天飞机准备起飞。 | +场景中,一名士兵戴着头盔站在一架大型飞机上。这架飞机似乎是一架军用军用飞机,似乎正准备登上一架飞机。另一个人则站在前面,可能正在观察飞行过程。在飞机周围,有几个人,其中一些站在左侧,另一些则站在右侧。他们似乎正在观看飞行员的表现。此外,还有一辆卡车停在靠近左侧的位置,可能是为了更具体地观察飞行过程。 |
![]() |
- 在野外,在山谷里。 | -图片中的植物和一只灰熊坐在草地上。 | -一只灰熊的近景 | -图片显示一只灰熊站在一片开放的草地上,周围有树木和草丛,还有一只背包放在上面。 | +
+
+
+ |
+ 图片中,一个女人坐在沙滩上,手里拿着一只白色的狗。她看起来像是个女人,坐在沙地上,看着她。一只狗也坐在她旁边,看起来很放松和舒适。海滩上散布着其他沙滩游客,有些人坐着,而另一些人则坐在更远的地方。背景中可以看到一艘船,这表明这是一个受欢迎的海滩旅游目的地。 | +两个人坐在海滩上,一边懒洋洋地躺在沙滩上,另一边则坐着。他们似乎正在享受海边时光。海滩上有几把椅子,其中一把靠近沙滩的左侧,另一把在中间。此外,还有一只狗躺在沙地上,为这个场景增添了一种放松的气氛。 |
![]() |
- 一群游客观看了这部电影。 | -这个图片描绘了一群海鸥在水面飞翔,在水面上。海鸥的出现表明,它们正在寻找食物。海鸥在水面上筑巢,可能是为了保护自己免受潜在的危险,如海鸥的尖锐牙齿和爬行动物。 | -一群海豚或绵羊在一天的航行中乘船捕鱼 | -这个图片显示一群人在海豚和海豚附近的大群中游泳。 | +
+
+
+ |
+ 照片捕捉到一幅美丽如画的大自然场景,背景是高山峦崖。在水边,一座巨大的喷泉横跨着水面,吸引着许多游客。水面上有几个人,他们或站或坐在喷泉周围,或站或坐。有些人可以看到他们在水中行走,而其他人则站在水边。总体而言,这幅画描绘的是一个美丽而宁静的环境,在那里人们可以欣赏到如画般的美景。 | +在一个美丽的蓝色天空下,一座巨大而巨大的白色瀑布上方悬挂着一只巨大的湿流水。这只瀑布位于一座山上,为整个场景增添了一种迷人而又宁静的气氛。在这幅图像的背景中,可以看到几艘船,其中一些靠近水边,其他的则离得较远。这些船只似乎正在为风景或户外活动做准备。 |
![]() |
- 一个女孩和她的朋友坐在一张长凳上,穿着长长的白色长袍。 | -这个场景描绘了一个充满活力的年轻女孩,她们穿着一件黑色和白色的服装,在一群人中间站着,他们都穿着黑色和白色的服装,这表明他们的服装是生动的、优雅的,在他们身边。在场景中,有两个女孩在背后,一个女人在背后,另一个女人站着,他们都穿着黑色的服装。这表明他们正在享受他们的服装和服装,可能正在参加一个特别的节日或庆祝活动。 | -女孩们在城市的街道上。 | -这个图片描绘了一个穿着传统服装的男人和女人,站在他们旁边,他们正在一起度过一个家庭时光。在整个场景中,可以看到一个小男孩和一个女孩,他们穿着牛仔帽,这表明他们正在参加一个家庭聚会,这可能是一次聚会或庆祝,或者他们可能正在讨论一个有趣的活动或活动。 | +
+
+
+ |
+ 图中,一个男人坐在公园的长椅上,旁边是一把绿色椅子。他身边有一本打开的书,上面写着"读书"一句话,暗示他可能正在阅读。公园里有一张长椅和一张公园长椅,为周围的环境增添了几分生气。在公园的周围,有几辆汽车和一辆卡车,表明这是一个公共区域。此外,还可以看到一个人站在公园的不同位置上,可能是等着上路或过马路。 | +一个穿着短裤的老人坐在公园长椅上,周围是树木。他似乎正在读一本书,可能是在读书。背景中有一座长凳,为这个场景提供了充足的座位。在背景中,可以看到一把椅子和一张餐桌,这说明这个场景可能是在一个户外座位区,那里有椅子供人们坐下来放松。 |
![]() |
- 这张照片中有几只鹿。 | -这个图片记录了一只白尾鹿, 它坐在草地上, 用它的照片来捕捉一只红鹿. | -这只动物看起来好像准备躲在树后面,他看上去很威严,因为他无法控制自己。 | -这个图片描绘了一只母鹿和一只鹿,这只母鹿在树林中站着,一只羊和一只鹿。 | +
+
+
+ |
+ 图中,一只白色的棕熊坐在草地上,旁边是一只长着棕色斑点的大熊。这只熊看起来很害羞或顽皮,因为它正躺在草地上休息,看上去很放松。 | +在这幅图像中,一只棕色的熊正在草地上漫步。这只熊被放置在草地上,占据了画面的大部分空间。它似乎正在自然环境中行走,可能是在草地上。在背景中,有几棵树,为画面增添了自然元素。一只鸟在场景的中间附近飞翔,为画面增添了生气勃勃的气氛。 |
![]() |
- 这个花束的花期几乎没有进数。 | -图片显示一只红色和黄色的花朵, 它们被称为“花瓶”。 | -花头的贴近。 | -图片显示了红色的花朵,周围有几个玫瑰花。 | +
+
+
+ |
+ 图片展示了一个漂亮的花瓶,里面插满了五颜六色的鲜花和花束。这些花束散落在整个花瓶中,给人一种赏心悦目的感觉。花瓶里插着五颜六色鲜花,创造出一种令人赏心悦目的景象。这些鲜花被摆放在一张桌子上,很可能是为了展示它们的美丽而摆放的。 | +场景中,一辆绿色和紫色相间的自行车停在一栋建筑旁边,它被放置在一棵大树旁。这辆自行车被摆放在附近,为这个场景增添了几分色彩。除了自行车外,还有一些其他的自行车,包括两个位于前景中的一个和位于背景中靠近中心位置的另一个。自行车的存在表明它可能是停在那里的。 |
![]() |
- 宇航员在太空任务中与地球相姿态。 | -这个图像描绘了一个充满活力的月球,在月球上散步。 | -宇航员在任务期间在摇篮上休息,与他的团队在背景。 | -这个图片描绘了一个宇航员在太空站的形象。 | -|||
![]() |
- 一只老虎在水里看着摄像机。 | -图片显示一只大棕色的海豹在水里游泳,在水里休息。 | -动物园里被囚禁的老虎 | -图片显示一只小熊,躺在一棵树枝上。 | -|||
![]() |
- 这个是濒危物种。 | -图片中,一只黑白的猫在岩石上散步。 | -野外云层的豹在洞穴外的岩石上,在日出时 | -该图片展示了一只小熊猫在岩石上散步的照片。 | +
+
+
+ |
+ 图片中的女人穿着一件白色连衣裙,脚上还系着一条黑色网球裙。她正在表演一个网球比赛,很可能是在比赛中。在背景中可以看到几把椅子,可能是为了观众或其他观众的座位安排而摆放的。此外,还有一个长凳放在场景左侧,为人们提供了一个休息的地方。 | +一名身穿白色衣服的女子站在舞台上,手里拿着一只手拿着白色飞盘。她似乎正在参加一个舞台舞会或比赛。场景中还有其他几个人,其中一个站在舞台左侧,另一个站在右侧,第三个人则站在场地右侧。舞台上有几个观众,有的站着,有的坐着,还有一些站着。这看起来像是一场欢乐的节日或活动。 |




| Image | -512_pretrain | -512_sft | -768_pretrain | -768_sft | +MiniMind2-V | +MiniMind2-V-Small | |
|---|---|---|---|---|---|---|---|
![]() |
- Hair and makeup, I like her natural hair! | -This picture depicts a young woman, she is wearing a suit, and a tie, which indicates that she may be attending a special fashion event or celebration. | -A human-made actor's adventure movie. | -This picture portrays a portrait of a woman, who is wearing a pink dress. | +
+
+
+ |
+ The image shows a busy city street with tall buildings on both sides of a long road. The street is packed with cars, trucks, and buses, along with many other vehicles driving on the road. There are many cars visible on the street, some driving at high speed, while others are parked at the side. Additionally, there is a bus parked on the right side of the street. Traffic lights are visible on the street, indicating a busy city environment. | +The image depicts a bustling urban scene with several cars and a truck driving down the city street. There are many traffic lights visible, some on the left side of the street, and others on the right. Several pedestrians can be seen on the street, some standing closer to the road while others are farther away. A parking sign is located on the left side of the image, hinting at the city environment. Two cars are visible on the street, one on the right and the other on the left, with another one also on the left side. This image captures a typical day in a city environment. |
![]() |
- Fossils in water, a still line composed of a ring of fossil clusters. | -The picture shows a large octopus, a potential marine creature, it is either on the surface of the water or in the ocean. | -Starfish and tentacles. | -The picture shows a starfish on the beach, including the starfish, and an underwater object. | +
+
+
+ |
+ The image shows an astronaut in a spacesuit sitting in a large spacecraft. They appear to be embarking on or disembarking from a space mission. Behind the astronaut, there is a rocket launch platform, likely to support the astronaut's mission during the journey. Additionally, an aircraft is parked near a hangar, further suggesting this is an aviation event. There are a few people around the aircraft, some standing close, possibly observing or waiting for the spacecraft to prepare for takeoff. | +The scene shows a soldier wearing a helmet standing on a large airplane. This aircraft appears to be a military one, likely preparing to board another plane. Another person stands in front, possibly observing the flight process. There are several people around the airplane, some standing on the left side, others on the right. They seem to be watching the pilot's performance. Additionally, a truck is parked near the left side, likely to observe the flight process more closely. |
![]() |
- In the wild, in the valley. | -The picture features plants and a grizzly bear sitting on the grass. | -A close-up of a grizzly bear | -The picture shows a grizzly bear standing in an open field of grass, surrounded by trees and bushes, with a backpack placed on top of it. | +
+
+
+ |
+ The image shows a woman sitting on the beach, holding a white dog in her hands. She appears to be a woman sitting on the sand, looking at her. A dog is also sitting beside her, looking relaxed and comfortable. Other beachgoers are scattered across the beach, some sitting, while others are farther away. A boat can be seen in the background, indicating that this is a popular beach destination for tourists. | +Two people are sitting on the beach, one lounging lazily on the sand, while the other is sitting. They seem to be enjoying their time by the sea. There are a few beach chairs, one close to the left side of the sand, another in the middle. Additionally, a dog is lying on the sand, adding to the relaxed atmosphere of the scene. |
![]() |
- A group of tourists watched this movie. | -This picture depicts a flock of seagulls flying over the water, on the water. The presence of seagulls suggests that they are looking for food. Seagulls nest on the water, possibly to protect themselves from potential dangers, such as sharp teeth and reptiles of seagulls. | -A group of dolphins or sheep fishing by boat during a day's voyage | -This picture shows a group of people swimming among a large group of dolphins and dolphins nearby. | +
+
+
+ |
+ The photo captures a beautiful natural scene with high mountains in the background. By the water, a large fountain spans across the surface, attracting many visitors. There are several people on the water's surface, some standing or sitting around the fountain, while others walk in the water. Overall, this image portrays a beautiful and peaceful environment where people can enjoy scenic views of nature. | +Under a beautiful blue sky, a massive white waterfall hangs above with a huge stream of wet water. This waterfall is located on a mountain, adding a charming and serene atmosphere to the whole scene. In the background of this image, several boats can be seen, some near the water's edge, others farther away. These boats seem to be preparing for scenic or outdoor activities. |
![]() |
- A girl and her friends are sitting on a bench, wearing long white robes. | -This scene depicts a vibrant young girl, they are dressed in black and white attire, standing in the middle of a crowd, all of whom are also dressed in black and white, indicating their outfits are lively and elegant. In the scene, there are two girls in the background, a woman behind, and another woman standing, all wearing black clothes. This suggests they are enjoying their outfits and attire, possibly attending a special festival or celebration. | -The girls are on the city streets. | -This picture portrays a man and a woman in traditional clothing, standing next to them, they are spending family time together. Throughout the scene, you can see a little boy and a girl, both wearing cowboy hats, which suggests they are participating in a family gathering, which could be a party or celebration, or they might be discussing an interesting activity or event. | +
+
+
+ |
+ The image shows a man sitting on a park bench next to a green chair. There is an open book beside him with the words "reading" written on it, suggesting he may be reading. The park has a bench and a park seat, adding life to the surrounding environment. There are several cars and a truck nearby, indicating this is a public space. Additionally, a person can be seen standing at different locations in the park, possibly waiting to cross the road or walk further. | +An elderly person wearing shorts sits on a park bench surrounded by trees. He seems to be reading a book, possibly engaged in reading. In the background, there is another bench providing ample seating for the scene. You can also see a chair and a table in the background, suggesting this may be an outdoor seating area where people can relax. |
![]() |
- This photo contains several deer. | -This picture captures a white-tailed deer, sitting on the grass, using its photo to capture a red deer. | -The animal looks as if it is about to hide behind a tree, he looks majestic, as he cannot control himself. | -This picture depicts a doe and a deer, the doe is standing in the woods, a sheep, and a deer. | +
+
+
+ |
+ The image shows a white brown bear sitting on the grass, next to a large bear with brown spots. This bear seems shy or playful as it lies on the grass, resting and looking relaxed. | +In this image, a brown bear is strolling on the grass. The bear occupies much of the frame, seemingly walking in its natural environment on the grass. In the background, there are several trees, adding natural elements to the scene. A bird is flying near the middle of the scene, bringing a lively atmosphere to the image. |
![]() |
- The bouquet's flowers have barely bloomed. | -The picture shows red and yellow flowers, which are called "vase". | -The flower heads are close together. | -The picture shows red flowers, surrounded by several roses. | +
+
+
+ |
+ The image shows a beautiful vase filled with colorful flowers and bouquets. The bouquets are scattered throughout the vase, creating a visually pleasant scene. The colorful flowers in the vase create a delightful visual. These flowers are placed on a table, likely displayed to showcase their beauty. | +The scene shows a green and purple bicycle parked next to a building, placed near a large tree. This bicycle is situated nearby, adding some color to the scene. In addition to the bicycle, there are other bicycles, including one in the foreground and another near the center of the background. The presence of the bicycles suggests they may be parked there. |
![]() |
- An astronaut posing with Earth during a space mission. | -This image depicts a dynamic moon, walking on the moon. | -An astronaut resting in a cradle during a mission, with his team in the background. | -This picture portrays an astronaut in the image of a space station. | -|||
![]() |
- A tiger in the water looking at the camera. | -The picture shows a large brown seal swimming in the water, resting in the water. | -A tiger caged in a zoo | -The picture shows a small bear, lying on a branch of a tree. | -|||
![]() |
- This is an endangered species. | -In the picture, a black and white cat is walking on the rocks. | -A leopard in the wild on the rocks outside a cave, at sunrise | -This picture shows a red panda walking on the rocks. | +
+
+
+ |
+ The woman in the image is wearing a white dress with a black tennis skirt. She is performing a tennis match, likely part of the competition. Several chairs are visible in the background, possibly set up for the audience or other spectators. Additionally, a bench is placed on the left side of the scene, providing a place for people to rest. | +A woman in white clothing stands on a stage holding a white frisbee. She seems to be participating in a stage dance or competition. Several other people are present in the scene, one standing on the left side of the stage, another on the right, and a third person standing near the right of the venue. The stage has several spectators, some standing, others sitting, with some remaining standing. This appears to be a joyful festival or event. |
| Image1 | Image2 | 512_sft_multi | +768_sft_multi | |||
|---|---|---|---|---|---|---|
![]() |
- ![]() |
- animal1 has a brown and black head with a black and white striped head . animal2 has a black head with a white stripe on its wings . | +![]() |
+ ![]() |
+ This image displays a bird scenario: a woman standing with a red and green mixed purple bird perched on her. The woman stands with the bird on her shoulders, while the red bird on her collar stands behind her. | +The two birds are flying in the same forest, some are in the center of the image, while others are smaller, creating a contrast. The birds’ presence highlights their flight ability and adaptability as they swiftly move through the woods. Additionally, the birds’ positions vary, with one on the left and the other on the right, indicating they are moving close within the same forest. Their natural behavior helps distinguish the two bird species. |
+ Hi, I'm MiniMind2-V
+