复现论文:PromptTA: Prompt-driven Text Adapter for Source-freeDomain Generalization

github:zhanghr2001/PromptTA: Source-free Domain Generalization

论文:2409.14163 PromptTA: Prompt-driven Text Adapter for Source-free Domain Generalization

自己标注:PromptTA: Prompt-driven Text Adapter for Source-free Domain Generalizationhttps://github.com/Unchanged-Originality/Unchanged-Originality/blob/main/Prompt-driven%20Text%20Adapter%20for%20Source-free%20Domain%20Generalization.pdf

流程图:

这篇论文主要是受 Domain-Unified Prompt Representations for Source-Free Domain Generalization和PromptStyler: Prompt-driven Style Generation for Source-free Domain Generalization启发。

github:这两篇论文我读标记

复现结果:

|-----------|------|------|------------|-----------|
| | PACS | VLCS | OfficeHome | DomainNet |
| ResNet-50 | 94.0 | 83.3 | 74.1 | |
| ViT-B/16 | 97.4 | 84.9 | 82.9 | |

PACS:

ResNet-50:

A:94.4 94.4 94.9 平均:94.733

C:95.3 95.2 95.2 95.233

P:99.5 99.5 99.5 99.5

s:86.5 86.4 86.7 86.567

平均 top - 1 准确率94.0

ViT-B/16:

a:97.9 97.9 98 97.933

C: 99.0 99.1 99.1 99.067

P:99.9 99.9 99.9 99.9

s:92.4 93.0 93.6 93

平均 top - 1 准确率97.475

VLCS:

ResNet-50:

C:100 100 100 平均:100

L:70.9 70.8 69.5 70.4

P:88.4 87.4 87.2 87.667

S:75.8 74.8 74.8 75.133

平均 top - 1 准确率83.3

ViT-B/16:

C:100 100 100 平均:100

L:71.3 74.7 75 73.667

P:89.8 90.4 90.1 90.1

S:77.1 75.3 76.0 76.133

平均 top - 1 准确率84.9

OfficeHome

ResNet-50:

A:73.3 73.3 73.5平均:73.367

C:55.3 55.2 55.0 55.167

P:84.2 84.3 83.9 84.133

R: 84.1 84.1 83.9 84.033

平均 top - 1 准确率74.1

ViT-B/16:

A:81.5 81.7 81.7 平均:81.633

C:70.1 70.0 70.6 70.233

P:89.7 90.0 89.8 89.833

r:90.0 90.3 90.2 90.167

平均 top - 1 准确率82.9

报错:

按照github配置环境过程中没出现问题。

AttributeError: module 'torch.utils.data' has no attribute 'collate'

改了半天,发现是原作者的引用错了

Traceback (most recent call last):

File "train.py", line 10, in <module>

from trainers import *

File "/opt/data/private/promptta/trainers/init.py", line 4, in <module>

from .prompt_ta import PROMPT_TA

File "/opt/data/private/promptta/trainers/prompt_ta.py", line 12, in <module>

from torch.utils.data import *

AttributeError: module 'torch.utils.data' has no attribute 'collate'

把prompt_ta.py文件中的 from torch.utils.data import *注释掉,改成

复制代码
from torch.utils.data import DataLoader, Dataset
复制代码
from torch.utils.data import TensorDataset

然后就可以正常运行了。

相关推荐
张张123y4 小时前
后端第十四课:Agent 记忆系统(让 Agent 记住上下文和用户,跨会话不健忘)
java·大数据·人工智能·python·agent·记忆
happylifetree9 小时前
Python67:核心语法-函数进阶-参数类型(函数作为参数)
python
小羊没烦恼!9 小时前
铁道部新客票系统设计(二)
开发语言·前端·数据库·python·oracle·c#·php
quantdash_cc10 小时前
从实时行情到价格观察表:用 Python 和 Pandas 构建策略输入数据
开发语言·python·数据分析·pandas·量化交易·股票数据·quantdash
镜子AI10 小时前
镜子AI工程实践:用 Python 做 GEO 实体一致性审计,并自动生成 JSON-LD 结构化数据
人工智能·python·json
2601_9628857214 小时前
如何用 Python 计算 VaR 和 CVaR(在险价值)?
开发语言·python
李航198314 小时前
DeepSeekAI建模三 - 实战建模一组柜子
人工智能·python·计算机视觉·ai·ai编程
严谨的麻辣烫16 小时前
静态代理 IP 的出口一致性如何验证?Python 请求检测与异常排查
开发语言·python·http·网络安全
我命由我1234516 小时前
5-1.Python 编码进阶 - 函数进阶(参数、返回值、递归、函数作为参数传递、lambda 匿名函数)
java·服务器·数据库·后端·python·java-ee·python3.11
FITA阿泽要努力16 小时前
Fork Agent:共享上下文的艺术
开发语言·python·agent