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] Cannot import name 'convert_file_size_to_int' from 'transformers.utils.hub' #123

Closed
1 task done
wqw547243068 opened this issue Mar 17, 2023 · 4 comments
Closed
1 task done

Comments

@wqw547243068
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

kaggle 默认环境下执行官方示例代码

错误信息:

ImportError: cannot import name 'convert_file_size_to_int' from 'transformers.utils.hub' (/opt/conda/lib/python3.7/site-packages/transformers/utils/hub.py)

Expected Behavior

No response

Steps To Reproduce

env:

  • pip install protobuf==3.20.0 transformers==4.26.1 icetk cpm_kernels
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda()
response, history = model.chat(tokenizer, "你好", history=[])
print(response)
response, history = model.chat(tokenizer, "晚上睡不着应该怎么办", history=history)
print(response)

Environment

- OS:
- Python: 3.7.12
- Transformers: 4.26.1
- PyTorch: 1.11.0
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) : true

Anything else?

No response

@duzx16
Copy link
Member

duzx16 commented Mar 17, 2023

什么是kaggle默认环境?

@wqw547243068
Copy link
Author

什么是kaggle默认环境?

kaggle新建notebook,系统默认的环境,没有更改

@duzx16
Copy link
Member

duzx16 commented Apr 12, 2023

提供的信息过少。这个方法是在 transformers 库内部 import 的,与本仓库无关

@duzx16 duzx16 closed this as completed Apr 12, 2023
@qiunlp
Copy link

qiunlp commented Jun 1, 2023

kaggle下运行,推理时报错,请教什么原因?

File ~/.cache/huggingface/modules/transformers_modules/model/quantization.py:274, in extract_weight_to_half(weight, scale_list, source_bit_width)
272 func = kernels.int8WeightExtractionHalf
273 elif source_bit_width == 4:
--> 274 func = kernels.int4WeightExtractionHalf
275 else:
276 assert False, "Unsupported bit-width"

AttributeError: 'NoneType' object has no attribute 'int4WeightExtractionHalf'

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