add model eva02 - #3429
Open
learncat163 wants to merge 4 commits into
Open
Conversation
|
Thanks for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EVA02模型
模型描述
EVA-02 是 BAAI-Vision 提出的视觉 Transformer 模型,基于 BEiT ViT 变体改进而来。相比于原始 EVA,EVA-02 引入了 Rotary Position Embedding (RoPE)、SwiGLU 激活、MLP 中的 Scale Norm 等技术,在多个图像分类基准上取得了优异性能。
模型变体
EVA02 共 4 种架构变体,其中 base/large 各有多个微调权重(不同预训练数据 + 微调策略),共 8 个权重。
预训练权重
权重来源
所有 EVA02 权重均从 timm (PyTorch Image Models) 权重转换而来
timm/eva02_tiny_patch14_336.mim_in22k_ft_in1keva02_tiny_patch14_336.mim_in22k_ft_in1k.pdparamstimm/eva02_small_patch14_336.mim_in22k_ft_in1keva02_small_patch14_336.mim_in22k_ft_in1k.pdparamstimm/eva02_base_patch14_448.mim_in22k_ft_in1keva02_base_patch14_448.mim_in22k_ft_in1k.pdparamstimm/eva02_base_patch14_448.mim_in22k_ft_in22k_in1keva02_base_patch14_448.mim_in22k_ft_in22k_in1k.pdparamstimm/eva02_large_patch14_448.mim_in22k_ft_in1keva02_large_patch14_448.mim_in22k_ft_in1k.pdparamstimm/eva02_large_patch14_448.mim_in22k_ft_in22k_in1keva02_large_patch14_448.mim_in22k_ft_in22k_in1k.pdparamstimm/eva02_large_patch14_448.mim_m38m_ft_in1keva02_large_patch14_448.mim_m38m_ft_in1k.pdparamstimm/eva02_large_patch14_448.mim_m38m_ft_in22k_in1keva02_large_patch14_448.mim_m38m_ft_in22k_in1k.pdparams使用方式
PaddleClas 中使用
精度对齐
1. 随机输入 Logit 对齐:timm vs Paddle(转换权重)
加载 timm 模型和 Paddle 转换权重,对比同一随机输入(seed=42)的 logits 输出,验证权重转换和 key 映射的正确性。每个模型在独立子进程中执行,避免 Paddle ParamAttr 命名冲突。
所有模型最大绝对误差在 1e-6 ~ 1e-5 量级,满足 1e-4 的精度要求,Top-1 预测完全一致。
2. ImageNet 验证集 Top-1 一致率验证
在 ImageNet 验证集(50000 张)上验证 paddle 与 timm 的 Top-1 预测一致率。)。
预处理使用 timm
create_transform(bicubic 插值、crop_pct、CLIP 归一化),paddle 与 timm 共享同一批预处理后的 tensor,确保对比的纯粹性。全部 8 个权重在 50000 张验证图上,paddle 与 timm 的 Top-1 预测一致率均为 100.0%。
3. 训练验证
固定 batch(4 张随机图 + 固定标签)反复训练 50 步,验证模型能对该 batch 拟合(loss 单调下降)。Optimizer 为 AdamW(lr=1e-4, weight_decay=0.05),Loss 为 CrossEntropyLoss,加载转换后的预训练权重。
EVA02_tiny_patch14_336 逐步 Loss
EVA02_small_patch14_336 逐步 Loss
EVA02_base_patch14_448 逐步 Loss
EVA02_large_patch14_448 逐步 Loss