Giter VIP home page Giter VIP logo

internlm4law's People

Contributors

admlrz avatar allyoung avatar ch521-od avatar ljn12yyds avatar yongxie66 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

internlm4law's Issues

下载权重到本地,模型装载异常

运行模型库上的示例代码碰到以下异常,不知是不是模型没上传正确?

import torch
import os
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoModel

base_path = './zhangsan_say_law'

os.system('apt install git')
os.system('apt install git-lfs')
os.system(f'git clone https://code.openxlab.org.cn/ljnyyds/zhangsan_say_law.git {base_path}')
os.system(f'cd {base_path} && git lfs pull')

tokenizer = AutoTokenizer.from_pretrained(base_path,trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(base_path,trust_remote_code=True, torch_dtype=torch.float16).cuda()


UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 128: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/zhanqing/projects/law_customer_service/src/pre_train/download_model2.py", line 15, in
model = AutoModelForCausalLM.from_pretrained(base_path,trust_remote_code=True, torch_dtype=torch.float16).cuda()
File "/home/zhanqing/anaconda3/envs/xtuner/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 556, in from_pretrained
return model_class.from_pretrained(
File "/home/zhanqing/anaconda3/envs/xtuner/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3502, in from_pretrained
) = cls._load_pretrained_model(
File "/home/zhanqing/anaconda3/envs/xtuner/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3903, in _load_pretrained_model
state_dict = load_state_dict(shard_file)
File "/home/zhanqing/anaconda3/envs/xtuner/lib/python3.10/site-packages/transformers/modeling_utils.py", line 551, in load_state_dict
raise OSError(
OSError: Unable to load weights from pytorch checkpoint file for '/data/models/zhangsan_say_law/pytorch_model-00001-of-00008.bin' at '/data/models/zhangsan_say_law/pytorch_model-00001-of-00008.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.