-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update big model ram #3062
base: develop
Are you sure you want to change the base?
update big model ram #3062
Conversation
Thanks for your contribution! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.comment需要好好改一下,所有的py需要注意下代码规范
2.建议ram放到arch下,不要放在backbone下
3.所有的文件需要过pre-commit
4.需要增加详细的文档,包括训练,infer、推理,可以参考:https://github.com/PaddlePaddle/PaddleClas/blob/develop/ppcls/configs/MultiLabelCOCO/MLDecoder/README.md
deploy/python/postprocess.py
Outdated
|
||
class RamOutPut(object): | ||
|
||
def __init__(self, language="cn",tag_list="", tag_list_chinese="", threshold=0.68, delete_tag_index=[], ram_class_threshold_path="ppcls/utils/RAM/ram_tag_list_threshold.txt"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文件需要过一下pre-commit,ram_class_threshold_path在yaml中传入
@@ -0,0 +1,52 @@ | |||
import os |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要增加版权信息
ppcls/arch/backbone/clip/clip.py
Outdated
@@ -0,0 +1,513 @@ | |||
import paddle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要增加版权信息
ppcls/arch/backbone/clip/clip.py
Outdated
) | ||
return model, get_transforms(224) | ||
|
||
def clip_vit_b_16_224(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的命名最好和paddleclas的整体命名保持一致
@@ -0,0 +1,140 @@ | |||
import gzip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
增加版权信息,增加代码引用信息
tools/infer_multimodal.py
Outdated
@@ -0,0 +1,18 @@ | |||
from __future__ import absolute_import |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
去掉,增加版权信息
from __future__ import print_function | ||
import os | ||
import sys | ||
__dir__ = os.path.dirname(os.path.abspath(__file__)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
注意规范和顺序
tools/train_multimodal.py
Outdated
@@ -0,0 +1,34 @@ | |||
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2023
from __future__ import print_function | ||
import os | ||
import sys | ||
__dir__ = os.path.dirname(os.path.abspath(__file__)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
注意规范和顺序
tools/train_multimodal.py
Outdated
|
||
if __name__ == "__main__": | ||
args = config.parse_args() | ||
args.config = "./ppcls/configs/ram/config_train.yaml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这不要写死
updated ram parameters: |
clip pretrain param: |
ram code with readme |
.gitignore
Outdated
@@ -15,3 +15,4 @@ nohup.out | |||
.idea | |||
inference/ | |||
test.py | |||
clip_text.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个去掉吧
size: 384 | ||
- NormalizeImage: | ||
scale: 0.00392157 | ||
mean: [0.485, 0.456, 0.406] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
官方的CLIP的mean和std不是这个值,这里需要确认下要不要改
@@ -71,7 +71,7 @@ def __init__(self, func_list, main_indicator="Topk"): | |||
def __call__(self, x, image_file=None): | |||
rtn = None | |||
for func in self.func_list: | |||
tmp = func(x, image_file) | |||
tmp = func(*x, image_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改这个的目的是?
delete_tag_index=[], | ||
ram_class_threshold_path=""): | ||
self.language = language | ||
assert tag_list, tag_list_chinese |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里需要给出报错信息
import cv2 | ||
import numpy as np | ||
|
||
from paddleclas.deploy.utils import logger, config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要从paddleclas下到入吧?
ppcls/configs/ram/README.md
Outdated
|
||
| Model | BackBone | Size | Inference Prompt | OpenImages-MAP | | ||
|-------|------------|--------|------------------|----------------| | ||
| RAM | Swin-large | 5.63GB | LLM Tag Dec | 82.2 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里需要指明CLIP用的是哪个模型
* 前往官方[repo](https://github.com/xinyu1205/recognize-anything/tree/main)下载对应数据集json文件。同时按照json文件目录格式,准备相应的数据。目录格式为: | ||
```json | ||
{ | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
里边的每个字段需要解释下
ppcls/configs/ram/README.md
Outdated
``` | ||
**注意:** | ||
1. 目前多标签分类的损失函数默认使用`AsymmetricLoss`。 | ||
2. 目前多标签分类的评估指标默认使用`MAP(integral)`。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
注意的这两个不太对吧?
ppcls/configs/ram/README.md
Outdated
|
||
得到类似下面的输出: | ||
``` | ||
{'class_ids': [[0, 593], [0, 871], [0, 998], [0, 2071], [0, 3336], [0, 3862]], 'scores': [871], 'label_names': ['棕色 | 鸡 | 公鸡 | 母鸡 | 红色 | 站/矗立/摊位']} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个scores是?
python3 -m paddle.distributed.launch \ | ||
--gpus="0,1,2,3" \ | ||
tools/train_multimodal.py \ | ||
-c ./ppcls/configs/ram/RAM.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
只有训练,没有finetune示例?
|
||
sampler: | ||
name: DistributedBatchSampler | ||
batch_size: 52 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
单卡bs
|
ram and ram plus pretrain:
链接:https://pan.baidu.com/s/1VV9PvEnC1e6yFj8Ccwr7Dg
提取码:ifgr
--来自百度网盘超级会员V6的分享