Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
hzy20001211 6a525483ef | 1 year ago | |
---|---|---|
config | 1 year ago | |
register | 1 year ago | |
repo | 1 year ago | |
ringmo_framework | 1 year ago | |
scripts | 1 year ago | |
trans_ckpt_tools | 1 year ago | |
LICENSE | 1 year ago | |
README.md | 1 year ago | |
__init__.py | 1 year ago | |
eval.py | 1 year ago | |
finetune.py | 1 year ago | |
ms_param | 1 year ago | |
pretrain.py | 1 year ago | |
requirements.txt | 1 year ago | |
setup.py | 1 year ago | |
test.py | 1 year ago | |
torch_pth | 1 year ago |
RingMo-Framework 是由中科院空天信息创新研究院与华为大模型研发团队联合打造的一款用于视觉领域的全国产化自监督预训练开发套件,旨在为业界提供高质量的视觉自监督预训练模型库和降低用户开发大规模预训练模型门槛,其中集成业界如MAE、SIMMIM、SimCLR等主流的视觉自监督预训练架构和专用于遥感领域的RingMo架构,包含Vit、Vit-moe、Swin(V1-V2)、Swin-moe等主流Transformer骨干网络,覆盖分类、分割、检测等下游任务的微调应用。同时基于Ascend芯片和MindSpore框架做深度优化适配,集成如MindInsight可视化、分布式并行策略配置、MOE专家系统、Profile性能分析、数据性能调优和Modelarts平台适配等模块,可极大提升开发者使用MindSpore开发大规模预训练模型体验。
Arch | BackBone |
---|---|
RingMo | Vit/Swin |
SimMIM | Vit/Swin |
MAE | Vit |
特性 | 是否支持 |
---|---|
并行配置 | 是 |
Mindinsight可视化 | 是 |
AICC平台适配 | 是 |
Profile性能分析 | 是 |
AutoTune | 是 |
图算融合 | 是 |
MOE | 尚未开源 |
Clone 仓库
git clone https://gitee.com/mindspore/ringmo-framework.git
准备数据
# 准备图片索引路径的json文件,如下方目录中的train_ids.json
python ringmo_framework/datasets/tools/get_image_ids.py --image IMAGE_PATH_DIR --file JSON_FILE_NAME
imagenet-1k/
├───train/
| ├───n01440764/
| | ├───n01440764_10026.JPEG
| | ├───n01440764_10027.JPEG
| | ├───...
| ├───n01443537/
| ├───...
├───val/
| ├───n01440764/
| | ├───n01440764_10026.JPEG
| | ├───n01440764_10027.JPEG
| | ├───...
| ├───n01443537/
| ├───...
└───train_ids.json # 存储图片路径列表的json文件--> ["imagenet-1k/train/n01440764/n01440764_10026.JPEG"]
预训练
# 单卡预训练
cd ringmo-framework/
python pretrain.py --config CONFIG_PATH --use_parallel False
# 分布式训练
cd ringmo-framework/
python ringmo_framework/tools/hccl_tools.py --device_num [0,8] # 生成分布式训练所需的RANK_TABLE_FILE,后面可跳过
cd scripts
sh pretrain_distribute.sh RANK_TABLE_FILE CONFIG_PATH START_DEVICE END_DEVICE # 执行分布式预训练
分类微调
# 单卡微调
cd ringmo-framework/
python finetune.py --config CONFIG_PATH --use_parallel False
# 分布式微调
cd scripts
sh finetune_distribute.sh RANK_TABLE_FILE CONFIG_PATH START_DEVICE END_DEVICE # 执行分布式微调
分类评估
# 单卡评估
cd ringmo-framework/
python eval.py --config CONFIG_PATH --eval_path CHECKPOINT_FILE --use_parallel False
# 分布式评估
cd scripts
sh eval_distribute.sh RANK_TABLE_FILE CONFIG_PATH START_DEVICE END_DEVICE CHECKPOINT_FILE # 执行分布式评估
下游任务迁移(待开放)
# 安装ringmo-framework库
pip install ringmo_framework
# 以使用MAE-Vit-Base-P16-img-224的预训练权重为例进行复杂下游任务迁移学习
from ringmo_framework.models.backbone.Vit import vit_base_p16
from ringmo_framework.tools import load_checkpoint
# 在目标检测网络Faster-RCNN中,使用ringmo-framework的vit_base_p16替换原有的resnet模型作为backbone
...
self.backbone = vit_base_p16(**kwargs)
...
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》