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

如何使用LMFlow训练自己的私有模型? #206

Closed
nuaa-wwbin opened this issue Apr 11, 2023 · 8 comments
Closed

如何使用LMFlow训练自己的私有模型? #206

nuaa-wwbin opened this issue Apr 11, 2023 · 8 comments

Comments

@nuaa-wwbin
Copy link

我是一名计算机专业的学生,但也是一名机器学习的门外汉,我想咨询一下,我应该怎么应该如何使用LMFlow?如何利用LMFlow来训练自己的私有模型?用于训练的数据应该是什么格式的?是否有相关教程或者guide?

@research4pan
Copy link
Contributor

Thanks for your interest in LMFlow! To use LMFlow, you may first obtain a Linux server with GPU equipped. We recommend Ubuntu 20.04, so that the setup will be most compatible with our settings. Then, following the guide in setup, you can install the LMFlow package.

To have a first taste of LMFlow, you may try our Google Colab demo, which requires a Google Colab account. Google Colab provide free T4 GPUs for users, so you may directly run our chatbot (a rather weak version) on that.

After that, you may finetune your model via scripts/run_finetune.sh, which corresponds to this section of README. You are free to modify our shell script, mainly modifying the used model --model_name_or_path gpt2 to other models. The output models will be in output_models/finetune. You may load that model with ./scripts/run_chatbot.sh output/models/finetune to have a chat with the finetuned model.

To specifying the dataset, you may change this line to the path of your customized dataset /path-to-your-dataset/*.json. The data format of *.json is provided in dataset section of README, where text_only format can be used for training decoder-only models.

Our guide is available in README. You are also welcomed to join our community for more information. Thanks 😄

@fengsxy
Copy link

fengsxy commented Apr 13, 2023

I have changed the model name but it doesn't work, because the error :
ValueError: Loading THUDM/chatglm-6b requires you to execute the configuration file in that repo on your local machine. Make sure you have read the code there to avoid malicious use, then set the option trust_remote_code=True to remove this error.

@research4pan
Copy link
Contributor

Thanks for providing more information! We have planned to support THUDM/chatglm-6b in this pull request, but haven't merged it yet. We will let you know once it is officially supported. Thanks! 🙏

@fengsxy
Copy link

fengsxy commented Apr 13, 2023

Thanks for providing more information! We have planned to support THUDM/chatglm-6b in this pull request, but haven't merged it yet. We will let you know once it is officially supported. Thanks! 🙏

I have reviewed the Code about Chatglm supporting, i think the core is to add the args about trust_remote_code=True
but i found the code only supported in inferencing not in finetuneing. And if i want fine-tune now, is it possible just add args about ``trust_remote_code=True`.

@vincent7f
Copy link

@fengsxy @research4pan

I have a quick fix to support trust_remote_code=True. All you need is to add a new line (line 215, trust_remote_code = True) to file LMFlow/src/lmflow/models/hf_decoder_model.py . Check the capture for details.

image

@research4pan
Copy link
Contributor

Thanks for your meaningful contribution! We will add this to our pull requests soon @shizhediao 😄 👍

@shizhediao
Copy link
Contributor

shizhediao commented Apr 19, 2023

Hi,
We are happy to share that ChatGLM inference is supported in our framework.
Please try this script: https://github.com/OptimalScale/LMFlow/blob/main/scripts/run_chatbot_chatglm.sh

@shizhediao
Copy link
Contributor

C�losed this issue.
If you have any further questions, please re-open it or create a new issue.

Thank you!

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

5 participants