Skip to content
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

[BUG] is_torch_greater_or_equal_than_1_13 under transformers/src/transformers /pytorch_utils.py has been removed in version 4.48.0 #722

Open
2 tasks done
ExcitingFrog opened this issue Jan 15, 2025 · 3 comments
Assignees

Comments

@ExcitingFrog
Copy link

是否已有关于该错误的issue或讨论? | Is there an existing issue / discussion for this?

  • 我已经搜索过已有的issues和讨论 | I have searched the existing issues / discussions

该问题是否在FAQ中有解答? | Is there an existing answer for this in FAQ?

  • 我已经搜索过FAQ | I have searched FAQ

当前行为 | Current Behavior

use latest transformers and load minicpm model:

from transformers.pytorch_utils import ALL_LAYERNORM_LAYERS, is_torch_greater_or_equal_than_1_13
ImportError: cannot import name 'is_torch_greater_or_equal_than_1_13' from 'transformers.pytorch_utils

期望行为 | Expected Behavior

No response

复现方法 | Steps To Reproduce

No response

运行环境 | Environment

- OS: ubuntu
- Python: 3.11
- Transformers: 4.48.0
- PyTorch:
- CUDA (`python -c 'import torch; print(torch.version.cuda)'`):  CUDA Version: 12.4

备注 | Anything else?

need to move is_torch_greater_or_equal_than_1_13 related code to modeling_minicpm.py

from packaging import version
parsed_torch_version_base = version.parse(version.parse(torch.__version__).base_version)
is_torch_greater_or_equal_than_2_4 = parsed_torch_version_base >= version.parse("2.4")
is_torch_greater_or_equal_than_2_3 = parsed_torch_version_base >= version.parse("2.3")
is_torch_greater_or_equal_than_2_2 = parsed_torch_version_base >= version.parse("2.2")
is_torch_greater_or_equal_than_2_1 = parsed_torch_version_base >= version.parse("2.1")
is_torch_greater_or_equal_than_2_0 = parsed_torch_version_base >= version.parse("2.0")
is_torch_greater_or_equal_than_1_13 = parsed_torch_version_base >= version.parse("1.13")
is_torch_greater_or_equal_than_1_12 = parsed_torch_version_base >= version.parse("1.12")
@YuzaChongyi
Copy link
Collaborator

Please try transformers==4.44.2. Other versions may have some compatibility issues, We are still working on it.

@ExcitingFrog
Copy link
Author

ExcitingFrog commented Jan 16, 2025

Please try transformers==4.44.2. Other versions may have some compatibility issues, We are still working on it.

sure, it works well when use some old version transformers, but we need to use some new features in latest transformers, we had added is_torch_greater_or_equal_than_1_13 related code in local code. This ticket can be fyi for you.
我们用老版本的的transformer库是好的 但是得用最新版本的功能 结果transformer把那块代码删掉了 是真的坑 只能自己加在本地了 你们可以做一个参考 后续可以看一下 thx

this issue can be closed or wait for some compatibility issues to fix
这个问题可以关闭 或者等后续修复后再关闭吧

@YuzaChongyi YuzaChongyi self-assigned this Jan 16, 2025
@iatharvmore
Copy link

can I work on this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants