transformers:ImportError: cannot import name ‘apply_chunking_to_forward‘ from ‘transformers.modeling
·
适用于transformers Version: 4.57.1
AI会让你换低版本,然后要搞rustc,tokenizers,非常的麻烦,成功概率不高。
看文档发现换了位置,那我们可以定位导入文件,
将
from transformers.modeling_utils import (
PreTrainedModel,
apply_chunking_to_forward,
find_pruneable_heads_and_indices,
prune_linear_layer,
)
改成
from transformers.modeling_utils import (
PreTrainedModel,
# apply_chunking_to_forward,
# find_pruneable_heads_and_indices,
# prune_linear_layer,
)
from transformers.pytorch_utils import (
# PreTrainedModel,
apply_chunking_to_forward,
find_pruneable_heads_and_indices,
prune_linear_layer,
)
更多推荐



所有评论(0)