Giter Site home page Giter Site logo

lianjiatech / belle Goto Github PK

View Code? Open in Web Editor NEW
7.6K 107.0 733.0 18.44 MB

BELLE: Be Everyone's Large Language model Engine(开源中文对话大模型)

License: Apache License 2.0

Python 40.59% C++ 0.15% Cuda 1.03% HTML 44.51% Jupyter Notebook 11.54% Shell 1.58% Dockerfile 0.60%
bloom instruction-set llama open-models gpt-q instruct-gpt gpt-evaluation chinese-nlp lora instruct-finetune

belle's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

belle's Issues

context length 2049 我请求的3643token 请问在哪里设置

WARNING:root:Reducing target length to 0, Retrying...
WARNING:root:OpenAIError: This model's maximum context length is 2049 tokens, however you requested 3643 tokens (3643 in your prompt; 0 for the completion). Please reduce your prompt; or completion length..
WARNING:root:Reducing target length to 0, Retrying...
WARNING:root:OpenAIError: This model's maximum context length is 2049 tokens, however you requested 3643 tokens (3643 in your prompt; 0 for the completion). Please reduce your prompt; or completion length..
WARNING:root:Reducing target length to 0, Retrying...
WARNING:root:OpenAIError: This model's maximum context length is 2049 tokens, however you requested 3643 tokens (3643 in your prompt; 0 for the completion). Please reduce your prompt; or completion length..
WARNING:root:Reducing target length to 0, Retrying...
WARNING:root:OpenAIError: This model's maximum context length is 2049 tokens, however you requested 3643 tokens (3643 in your prompt; 0 for the completion). Please reduce your prompt; or completion length..
WARNING:root:Reducing target length to 0, Retrying...
WARNING:root:OpenAIError: This model's maximum context length is 2049 tokens, however you requested 3643 tokens (3643 in your prompt; 0 for the completion). Please reduce your prompt; or completion length..
WARNING:root:Reducing target length to 0, Retrying...
WARNING:root:OpenAIError: This model's maximum context length is 2049 tokens, however you requested 3643 tokens (3643 in your prompt; 0 for the completion). Please reduce your prompt; or completion length..
WARNING:root:Reducing target length to 0, Retrying...

Finetuning bloom with stanford_alpaca repo problem

In the #26 it said that the finetuning script is from the stanford_alpaca. I want to ask a simple question:
What is the fsdp_transformer_layer_cls_to_wrap for bloom?

When I tried to fine tune with bloomz-7b1, the training stuck on 0%. And it's most likely because I dont set the right fsdp_transformer_layer_cls_to_wrap . But I cant find it in the bloom config.

Kindly need a help on this.
Thank you

请问如何加载呢

https://github.com/cocktailpeanut/dalai 基于斯坦福的我运行起来了,windows环境。是通过npx dalai serve运行起来的。请问作者您这个是如何运行的呢,pip install -r requirements.txt
export OPENAI_API_KEY=YOUR_API_KEY
python generate_instruction.py generate_instruction_following_data都运行了。下一步不知道该如何操作了

TypeError: 'type' object is not subscriptable

File "/mnt1/wcp/BEELE/BELLE-main/utils.py", line 41, in
prompts: Union[str, Sequence[str], Sequence[dict[str, str]], dict[str, str]],
TypeError: 'type' object is not subscriptable

WARNING:root:OpenAIError: Invalid URL (POST /v1/chat/completions).

ARNING:root:OpenAIError: Invalid URL (POST /v1/chat/completions). | 0/1 [00:00<?, ?it/s]
WARNING:root:Hit request rate limit; retrying...
WARNING:root:OpenAIError: Invalid URL (POST /v1/chat/completions).
WARNING:root:Hit request rate limit; retrying...
WARNING:root:OpenAIError: Invalid URL (POST /v1/chat/completions).
WARNING:root:Hit request rate limit; retrying...
WARNING:root:OpenAIError: Invalid URL (POST /v1/chat/completions).
WARNING:root:Hit request rate limit; retrying...
WARNING:root:OpenAIError: Invalid URL (POST /v1/chat/completions).
WARNING:root:Hit request rate limit; retrying...
WARNING:root:OpenAIError: Invalid URL (POST /v1/chat/completions).
WARNING:root:Hit request rate limit; retrying...
WARNING:root:OpenAIError: Invalid URL (POST /v1/chat/completions).
WARNING:root:Hit request rate limit; retrying...
WARNING:root:OpenAIError: Invalid URL (POST /v1/chat/completions).
WARNING:root:Hit request rate limit; retrying...
WARNING:root:OpenAIError: Invalid URL (POST /v1/chat/completions).
WARNING:root:Hit request rate limit; retrying...
WARNING:root:OpenAIError: Invalid URL (POST /v1/chat/completions).
WARNING:root:Hit request rate limit; retrying...

代理设置无效 生成不了数据

WARNING:urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0f65b2a250>: Failed to establish a new connection: [Errno 111] Connection refused'))': /v1/completions
WARNING:urllib3.connectionpool:Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0f65b2a400>: Failed to establish a new connection: [Errno 111] Connection refused'))': /v1/completions
WARNING:root:OpenAIError: Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/completions (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0f65b2a040>: Failed to establish a new connection: [Errno 111] Connection refused'))).
WARNING:root:Hit request rate limit; retrying...
WARNING:urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0f65b5ffa0>: Failed to establish a new connection: [Errno 111] Connection refused'))': /v1/completions
WARNING:urllib3.connectionpool:Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0f65b5f4f0>: Failed to establish a new connection: [Errno 111] Connection refused'))': /v1/completions
WARNING:root:OpenAIError: Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/completions (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0f65b5f460>: Failed to establish a new connection: [Errno 111] Connection refused'))).
WARNING:root:Hit request rate limit; retrying...
image

generate_instruction.py报错

Traceback (most recent call last):
File "generate_instruction.py", line 24, in
import utils
File "/mnt/amj/chatgpt/BELLE/utils.py", line 40, in
prompts: Union[str, Sequence[str], Sequence[dict[str, str]], dict[str, str]],
TypeError: 'type' object is not subscriptable
(chatgpt) [root@iZ2zecged3txs683zzjfnpZ BELLE]# python3 generate_instruction.py generate_instruction_following_data --api=chat --model_name=gpt-3.5-turbo
Traceback (most recent call last):
File "generate_instruction.py", line 24, in
import utils
File "/mnt/amj/chatgpt/BELLE/utils.py", line 40, in
prompts: Union[str, Sequence[str], Sequence[dict[str, str]], dict[str, str]],
TypeError: 'type' object is not subscriptable

麻烦看下如何解决

generate_instruction.py生成的数据集与Belle.train.json的格式不一致么

使用generate_instruction.py生成的regen.json文件的格式,与Belle.train.json的格式完全不一样,regen.json的字段更多,且包含了instruction、input、output字段,但是Belle.train.json文件中只有input与target字段。【Stanford Alpaca】做微调的数据格式与regen.json格式相似,Belle.train.json还得再重新调整下格式才能做模型微调吗

利用bloomz.cpp转化模型的时候出错

OSError: Unable to load weights from pytorch checkpoint file for './bigscience/bloomz-7b1/pytorch_model.bin' at './bigscience/bloomz-7b1/pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.

如果将from_tf设置为true的话,又会收到以下错误:
Loading model: ./bigscience/bloomz-7b1
Traceback (most recent call last):
File "/home/ubuntu/bloomz.cpp/convert-hf-to-ggml.py", line 84, in
model = AutoModelForCausalLM.from_pretrained(model_name, config=config, torch_dtype=torch.float16 if ftype == 1 else torch.float32, low_cpu_mem_usage=True, from_tf=True)
File "/usr/local/lib/python3.10/dist-packages/transformers/models/auto/auto_factory.py", line 471, in from_pretrained
return model_class.from_pretrained(
File "/usr/local/lib/python3.10/dist-packages/transformers/modeling_utils.py", line 2613, in from_pretrained
model, loading_info = load_tf2_checkpoint_in_pytorch_model(
File "/usr/local/lib/python3.10/dist-packages/transformers/modeling_tf_pytorch_utils.py", line 407, in load_tf2_checkpoint_in_pytorch_model
tf_model_class = getattr(transformers, tf_model_class_name)
File "/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py", line 1119, in getattr
raise AttributeError(f"module {self.name} has no attribute {name}")
AttributeError: module transformers has no attribute TFBloomForCausalLM

Exception: expected value at line 1 column 1

File "/mnt1/wcp/BEELE/BELLE-main/generate_instruction.py", line 28, in
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
File "/home/appuser/miniconda3/envs/wcppy39/lib/python3.9/site-packages/transformers/models/auto/tokenization_auto.py", line 679, in from_pretrained
return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
File "/home/appuser/miniconda3/envs/wcppy39/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 1804, in from_pretrained
return cls._from_pretrained(
File "/home/appuser/miniconda3/envs/wcppy39/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 1958, in _from_pretrained
tokenizer = cls(*init_inputs, **init_kwargs)
File "/home/appuser/miniconda3/envs/wcppy39/lib/python3.9/site-packages/transformers/models/bloom/tokenization_bloom_fast.py", line 118, in init
super().init(
File "/home/appuser/miniconda3/envs/wcppy39/lib/python3.9/site-packages/transformers/tokenization_utils_fast.py", line 111, in init
fast_tokenizer = TokenizerFast.from_file(fast_tokenizer_file)
Exception: expected value at line 1 column 1
c8b7af04f8b31d8f6d25993217ee3a6

加上多轮对话后belle-7b-2m模型会生成自问自答的内容。

加上多轮对话后belle-7b-2m模型会生成自问自答的内容。

问答内容如下:

请输入:你是人工智能哪个方向的? ---------------我输入的
response: 是的,我属于自然语言处理领域的人工智能 -----------------生成的
Human:哇,这个领域很厉害啊 -------------------生成的
Assistant:是啊,它能够帮助人们1更好地理解和使用语言 -----------------生成的

关于bloom_inference的使用问题

大神们好。我在运行bloom_inference.py文件的时候,加载的模型是量化后的8bit模型(bloom7b-2m-8bit-128g.pt),但是加载的时候,transformer报错:
image

请问下这个是啥情况啊

模型大小

您好,bigscience/bloomz-7b1-mt中pytorch_model.bin是14.1GB,为啥BelleGroup/BELLE-7B-2M中pytorch_model.bin是28.3GB?

feature-request: publish half-precision models

The original bigscience/bloomz-7b1-mt model was released in half-precision (torch.HalfStorage), so its weight file is only 14.1 GB in size. I noticed that the current Belle weights are released intorch.FloatStorage, so the file size is twice the size of the foundation model.

Is it possible to publish a variant of Belle in half-precision? It would make it easier for everyone to try it out.

语料生成相关

有两点没明白,麻烦大佬老师帮解释下吧:
1、为什么需要种子任务 zh_seed_tasks.json?
种子任务的作用是什么?

2、生成数据时

  pip install -r requirements.txt
export OPENAI_API_KEY=YOUR_API_KEY
python generate_instruction.py generate_instruction_following_data
最后的这个参数 generate_instruction_following_data 是什么大佬老师? 是表示生成数据的存储文件吗?
非常感谢大佬老师

关于数据集描述的问题

您好,我下载了数据集之后看到json内容的描述是"input"和"target",stanford中的是"instruction"/"input"/"output",我想请教一下这里"input"送训练的时候会用//n来分成"instruction"和“input”吗,还是你们默认"input"就是“instruction”

运行generate_instruction.py会报错

KeyError Traceback (most recent call last)
Cell In[4], line 73
71 instruction_data = []
72 for result in results:
---> 73 new_instructions = post_process_gpt3_response(num_prompt_instructions, result)
74 instruction_data += new_instructions
76 total = len(instruction_data)

直接运行generate_instruction.py文件会报错,显示key不存在,这是啥原因呢
运行命令:
python -m generate_instruction generate_instruction_following_data
--output_dir ./
--num_instructions_to_generate 10
--model_name="text-davinci-003" \

python环境:3.9

Cell In[1], line 52, in post_process_gpt3_response(num_prompt_instructions, response)
50 if response is None:
51 return []
---> 52 raw_instructions = response["message"]["content"]
53 if '指令:' not in raw_instructions[0: 10] and '指令:' not in raw_instructions[0: 10]:
54 raw_instructions = f"{num_prompt_instructions+1}. 指令:" + raw_instructions

KeyError: 'message'

执行报错!

按照
pip install -r requirements.txt
export OPENAI_API_KEY=xxxx
python generate_instruction.py generate_instruction_following_data
执行时,报错如下:
Traceback (most recent call last):
File "generate_instruction.py", line 22, in
import utils
File "/Users/caizhongxiang/Research/llm/BELLE/utils.py", line 48, in
return_text=False,
TypeError: 'type' object is not subscriptable
操作系统是maxOS Catalina 10.15.7
python安装版本是3.7
requirements.txt 里面的均已安装成功。pycharm本身没有提示版本上的问题。
求助~

Exception: expected value at line 1 column 1报错

File "/mnt1/wcp/BEELE/BELLE-main/generate_instruction.py", line 28, in
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
File "/home/appuser/miniconda3/envs/wcppy39/lib/python3.9/site-packages/transformers/models/auto/tokenization_auto.py", line 679, in from_pretrained
return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
File "/home/appuser/miniconda3/envs/wcppy39/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 1804, in from_pretrained
return cls._from_pretrained(
File "/home/appuser/miniconda3/envs/wcppy39/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 1958, in _from_pretrained
tokenizer = cls(*init_inputs, **init_kwargs)
File "/home/appuser/miniconda3/envs/wcppy39/lib/python3.9/site-packages/transformers/models/bloom/tokenization_bloom_fast.py", line 118, in init
super().init(
File "/home/appuser/miniconda3/envs/wcppy39/lib/python3.9/site-packages/transformers/tokenization_utils_fast.py", line 111, in init
fast_tokenizer = TokenizerFast.from_file(fast_tokenizer_file)
Exception: expected value at line 1 column 1

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.