@@ -14,7 +14,7 @@ InternVL 是一种用于多模态任务的深度学习模型,旨在处理和
1414
1515## Dynamic High Resolution
1616
17- 动态高分辨率,为了让ViT模型能够尽可能获取到更细节的图像信息 ,提高视觉特征的表达能力。对于输入的图片,首先resize成448的倍数,然后按照预定义的尺寸比例从图片上crop对应的区域。细节如图所示。
17+ InternVL独特的预处理模块: 动态高分辨率,是为了让ViT模型能够尽可能获取到更细节的图像信息 ,提高视觉特征的表达能力。对于输入的图片,首先resize成448的倍数,然后按照预定义的尺寸比例从图片上crop对应的区域。细节如图所示。
1818
1919![ image] ( https://github.com/user-attachments/assets/c49fef28-0818-432f-bc52-1170e2207f44 )
2020
@@ -163,7 +163,11 @@ python3 test_lmdeploy.py
163163```
164164
165165#### 推理后
166+
167+ > 推理出来有什么文字是纯随机的,并不一定和展示结果完全一致哦~
168+
166169推理后我们发现直接使用2b模型不能很好的讲出梗,现在我们要对这个2b模型进行微调。
170+
167171![ image] ( https://github.com/user-attachments/assets/3bc5bb1f-5ab4-40f0-817a-8d11ec52b48d )
168172
169173### InternVL 微调攻略
@@ -413,7 +417,11 @@ NPROC_PER_NODE=1 xtuner train /root/InternLM/code/XTuner/xtuner/configs/internvl
413417
414418用官方脚本进行权重合并
415419
420+ > 如果这里你执行的epoch不是6,是小一些的数字。你可能会发现internvl_ft_run_8_filter下没有iter_3000.pth, 那你需要把iter_3000.pth切换成你internvl_ft_run_8_filter目录下的pth即可。
421+
416422``` bash
423+ cd XTuner
424+ # transfer weights
417425python3 xtuner/configs/internvl/v1_5/convert_to_official.py xtuner/configs/internvl/v2/internvl_v2_internlm2_2b_qlora_finetune.py /root/InternLM/work_dir/internvl_ft_run_8_filter/iter_3000.pth /root/InternLM/InternVL2-2B/
418426```
419427
@@ -444,7 +452,7 @@ python3 xtuner/configs/internvl/v1_5/convert_to_official.py xtuner/configs/inter
444452
445453![ image] ( https://github.com/user-attachments/assets/8a802287-5472-4630-adcd-e671f0cc8b3c )
446454
447- 我们把这行代码替换一下 ,然后跑一下效果。
455+ 我们把下面的代码替换进test_lmdeploy.py中 ,然后跑一下效果。
448456
449457``` python
450458from lmdeploy import pipeline
@@ -457,6 +465,12 @@ response = pipe(('请你根据这张图片,讲一个脑洞大开的梗', image
457465print (response.text)
458466```
459467
468+ ``` python
469+ cd / root/ InternLM/ code
470+
471+ python3 test_lmdeploy.py
472+ ```
473+
460474效果还不错吧~哈哈哈。
461475
462476![ image] ( https://github.com/user-attachments/assets/3f2cdefb-9883-4f15-a30e-54a2ce450141 )
0 commit comments