Git Product home page Git Product logo

evilpsycho / play-with-llms Goto Github PK

View Code? Open in Web Editor NEW
454.0 454.0 74.0 1.33 MB

Tutorial on training, evaluating LLM, as well as utilizing RAG, Agent, Chain to build entertaining applications with LLMs.分享如何训练、评估LLMs,如何基于RAG、Agent、Chain构建有趣的LLMs应用。

Home Page: https://kky42.com/

License: MIT License

Python 20.60% Shell 1.18% Jupyter Notebook 78.22%
agent baichuan2 chatgpt gpt large-language-models llama2 llms mistral rag retrieval-augmented-generation

play-with-llms's People

Contributors

echohandsome avatar evilpsycho avatar

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

play-with-llms's Issues

peft==0.4.0.dev0版本

peft==0.4.0.dev0
要怎么下载啊,pip下载时候报错,没有这个版本。添加了各个镜像源也不行

ValueError: Target modules [] not found in the base model. Please check the target modules and try again.

train:
/opt/conda/envs/py310/bin/python train.py --model_name baichuan
--model_path /Data/cj/ML/baichuan-inc/baichuan-7B
--quantization float16
--data_name belle_open_source_500k
--data_path ./data/Belle_open_source_0.5M.json
--train_size 20000
--output_dir ./output/baichuan_lorasft
--seed 42
--max_len 1024
--lora_rank 8
--num_train_epochs 1
--learning_rate 3e-4
--per_device_train_batch_size 4
--per_device_eval_batch_size 8
--gradient_accumulation_steps 1
--logging_steps 10
--evaluation_strategy steps
--save_strategy steps
--eval_steps 100
--save_steps 100
--report_to tensorboard
--save_total_limit 3
--load_best_model_at_end true
--optim adamw_torch

error:
/Data/cj/ML/train_custom_LLM-main/train.py:105 in │
│ │
│ 102 │ model.save_pretrained(training_args.output_dir) │
│ 103 │
│ 104 if name == "main": │
│ ❱ 105 │ main() │
│ │
│ /Data/cj/ML/train_custom_LLM-main/train.py:74 in main │
│ │
│ 71 │ ) │
│ 72 │ │
│ 73 │ print(config) │
│ ❱ 74 │ model = get_peft_model(model, config) │
│ 75 │ │
│ 76 │ ############# prepare data ########### │
│ 77 │ data = eval(args.data_name)(args.data_path, tokenizer, args.max_le │

ValueError: Target modules [] not found in the base model. Please check the target modules and try again.

peft 版本

哈喽,当前拉的最新peft 没有0.4.0dev
image

Some tips for this repo.

This repo with videos is helpful to me.
Nevetheless, I still met some issues.
May the following tips save your time.

  1. [Linux:Yes, Windows:No] Bitsandbytes is officially maintained on Linux. Hence, you may not use the 4-bit, 8-bit model on a Windows platform.
  2. [Need fine-tune:Yes, Directly use:No] Firstly, you should train the 4-bit model from scratch. Secondly, you can get the fine-tuned model in the output folder. Finally, you can check the results in the notebook and compare the performance with/without fine-tuning.
  3. [P40x1-4-bit-model:Yes, V100x1-bfloat16-model:No] Currently, you can fine-tune the 4-bit-model with a P40-GPU (24G) on Linux, but you can not fine-tune the bfloat16 model with a V100-GPU(32G) on Windows.
  4. [Training time based on the default settings]: 4950 iteration in total, 300 iterations for the first 55 min, hence, the whole fine-tunning would take about 15 hours.

一些安装环境的tips

对于CUDA大于等于12.0的,需要直接安装bitsandbytes最新版本(我这边显示不兼容):pip install -U bitsandbytes
除了requirements.txt里的,还要安装其他包:datasets、sentencepiece、scipy

关于输入

我有一点疑惑,请问为什么没有mask将instruction+input 的损失mask掉。看代码的意思是输入为instruction+input+output,然后预测目标也是instruction+input+output。

一个奇怪的问题

在微调的时候,200个迭代之后,开始eval,显存会直接飙升一截,并且不再下降。不知道这个泄露是什么引起的

代码报错

result = tokenizer(
prompt,
truncation=True,
max_length=max_len,
padding=False,
return_tensors=None,
)
为什么result的input 没有 bos 和 eos 标志
而且 result["attention_mask"].append(1) 报错
提示result["attention_mask"]为numpy类型 [[Fasle,.........True],[False,False,False...False]]

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.