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

想要在linux&win运行B友 #7

Open
zhenaiwork opened this issue May 13, 2024 · 14 comments
Open

想要在linux&win运行B友 #7

zhenaiwork opened this issue May 13, 2024 · 14 comments

Comments

@zhenaiwork
Copy link

林哥你好,我看了你的视频对这个B的兴趣很大,想要把它在我自己本地的Linux服务器上运行玩玩。
但目前最大的问题是你使用的开发框架似乎只有mac电脑可以使用,所以希望你可以提供可以在linux运行的方法。

@LonePheasantWarrior
Copy link

林哥你好,我看了你的视频对这个B的兴趣很大,想要把它在我自己本地的Linux服务器上运行玩玩。 但目前最大的问题是你使用的开发框架似乎只有mac电脑可以使用,所以希望你可以提供可以在linux运行的方法。

你的Linux服务器有高性能GPU吗,感觉这玩意不是随便就能跑的啊

@zhenaiwork
Copy link
Author

报错了

# python3 -m mlx_lm.lora --model models/Qwen1.5-32B-Chat --data data/ --train --iters 1000
--batch-size 16 --lora-layers 12
Loading pretrained model
Segmentation fault

@zhenaiwork
Copy link
Author

实际证明我的机器接不住这个B友【双路e5+64g ddr4】

Loading pretrained model
Killed

@zhenaiwork
Copy link
Author

如何在linux运行这个B

首先把林哥的B 下载到本地并按照林哥的文档安装必要的依赖文件,包括mlx。

 pip install mlx-lm

然后在启动之前你还需要下载32B的模型文件。
首先要在项目跟目录下创建models文件夹,在把32B用git clone进去。
如果发现clone下来的文件只有 XX MB那说明有问题这里提供第二种下载方式,
先安装必要的pip库

pip install modelscope 

然后执行python3启动python终端,在python终端中执行下面代码

#模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('qwen/Qwen1.5-32B-Chat')

下载完成输入quit()退出python终端
然后在~/.cache/modelscope/hub找到下载好的模型文件给它复制到开始创建的models文件夹【注意检查模型文件夹的名称是否为:Qwen1.5-32B-Chat】
完成后的文件结构bilibot/models/Qwen1.5-32B-Chat
然后运行林哥文档中的启动命令然后爆 内存/显存 [滑稽]

目前在我本地测试32B需要起码64G的内存。

This was referenced May 13, 2024
@zhenaiwork
Copy link
Author

跑起来了,但是又了新的报错

Loading pretrained model
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Total parameters 32513.791M
Trainable parameters 1.573M
Loading datasets
Training
Starting training..., iters: 1000
terminate called after throwing an instance of 'std::runtime_error'
  what():  [AddMM::eval_cpu] Currently only supports float32.
./t-run.sh: line 1:   215 Aborted                 python3 -m mlx_lm.lora --model models/Qwen1.5-32B-Chat --data data/ --train --iters 1000 --batch-size 16 --lora-layers 12

@zhenaiwork
Copy link
Author

新的思路

林哥给的是一个在M系列芯片运行的版本无法在X86机器上运行,但是林哥给了我们训练需要的数据集,那么我们是否可以用其他方法对Qwen进行lora微调

@fimreal
Copy link

fimreal commented May 14, 2024

看样子,这么大内存非mbp跑不了
服务器倒是能有这么大内存,但是么有显卡

@simon7238
Copy link

苹果的M系列CPU有统一内存技术,可以把内存当显存用,如果要在非苹果M系列CPU中训练32B模型我初步估计要64G显存的显卡,看样子没有H100、H800估计没戏。

@obiscr
Copy link

obiscr commented May 14, 2024

对,最主要就是M系列的cpu,还有统一内存。

@zhenaiwork
Copy link
Author

你的下一台电脑何必是X86

@join20252
Copy link

你的下一台电脑何必是X86

一定是arm机

@Lion-Wu
Copy link

Lion-Wu commented May 29, 2024

mlx是苹果的机器学习框架,目前只能用于苹果芯片,无法在其他设备上运行。

@YHX2010
Copy link

YHX2010 commented Aug 4, 2024

Emm……估计要把MLX优化过的LoRA手动替换成普通LoRA(我用Mac所以无感)

@YHX2010
Copy link

YHX2010 commented Aug 4, 2024

苹果的M系列CPU有统一内存技术,可以把内存当显存用,如果要在非苹果M系列CPU中训练32B模型我初步估计要64G显存的显卡,看样子没有H100、H800估计没戏。

赞成,Linux&Windows 没个专业卡估计真没戏,要么就换小模型(但是小模型效果估计差一点)

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

9 participants