mindspore-lab / mindnlp

Easy-to-use and high-performance NLP and LLM framework based on MindSpore, compatible with models and datasets of 🤗Huggingface.
https://mindnlp.cqu.ai/
Apache License 2.0
580 stars 151 forks source link

mindspore.ops.interpolate不支持mode="bicubic"模式下传入scale_factor参数 #1373

Open xuzihao2024 opened 2 weeks ago

xuzihao2024 commented 2 weeks ago

Describe the bug/ 问题描述 (Mandatory / 必填) 在DINOv2模型迁移时遇到该问题, PR链接:https://github.com/mindspore-lab/mindnlp/pull/1375, mindnlp/transformers/models/dinov2/modeling_dinov2.py:line83

mindspore.ops.interpolate不支持mode="bicubic"模式下传入scale_factor参数。 根据官方文档,若添加recompute_scale_factor=True可规避报错,但当scale_factor为浮点数时会产生精度误差。 官方文档:https://www.mindspore.cn/docs/zh-CN/master/note/api_mapping/pytorch_diff/interpolate.html

To Reproduce / 重现步骤 (Mandatory / 必填)

Expected behavior / 预期结果 (Mandatory / 必填)

支持mode="bicubic"时传入浮点型scale_factor

Screenshots/ 日志 / 截图 (Mandatory / 必填)

image

Additional context / 备注 (Optional / 选填)