Giter Site home page Giter Site logo

Comments (17)

Facico avatar Facico commented on May 18, 2024

@alisyzhu
感谢你提供这个问题。这个可能是bitsandbytes的问题,如果是V100用8bit加载很容易炸loss。想问一下你的显卡是V100吗,我们之前确实没有注意这个问题,V100是不支持8bit tensor core的,如下图。

图片

相关issue: issue1, issue2, issue3

还有一个问题,我想知道你用我们的generate、interaction等测试文件能生成正常的结果吗(我们推理文件也是自动load 8bit
的)

如果用V100的话,可以把load_in_8bit改成False,loss应该就不容易炸了。

from chinese-vicuna.

alisyzhu avatar alisyzhu commented on May 18, 2024

是v100的,我之前就感觉配置环境的时候,这个bitsandbytes总是感觉不太正常,但本人对GPU不是很懂。因为一直感觉fine-tune不太正常,还没有generate和interaction。
如果我只能用v100fine-tune和generate的话,是不是把所有load_in_8bit的地方都设置成false就可以呢?那还需要配置bitsandbytes这个依赖包吗?
另外,我还想问下,如果不用8bit了,那么在后续还需要调用tools里的脚本做LLAMA的量化吗?一直没看懂这个量化什么时候需要做,有什么作用,我理解就是让模型变小的?

from chinese-vicuna.

alisyzhu avatar alisyzhu commented on May 18, 2024

将fine-tune里的load_in_8bit设置为False,4个GPU就报
image

from chinese-vicuna.

rookiebird avatar rookiebird commented on May 18, 2024

讲道理load_in_8bit=True的话,v100跑个程序应该会报错啊,我是一直报错的,后面改成了load_in_8bit=False 才正常,然后用了.half()来记载模型训练,否则32Gv100会报oom

from chinese-vicuna.

alisyzhu avatar alisyzhu commented on May 18, 2024

但是改成load_in_8bit=False,报了OOM,我用了8个v100,也还是OOM,请问你是几个v100,数据量个batch_size多少呀,可以跑起来?
.half()是怎么执行的呀?

from chinese-vicuna.

alisyzhu avatar alisyzhu commented on May 18, 2024

讲道理load_in_8bit=True的话,v100跑个程序应该会报错啊,我是一直报错的,后面改成了load_in_8bit=False 才正常,然后用了.half()来记载模型训练,否则32Gv100会报oom

请问是将finetune.py的这部分这样修改吗?
image

from chinese-vicuna.

rookiebird avatar rookiebird commented on May 18, 2024

我没有用8个v100, 我是两个啊, 一个v100 是32G的, 是你这样改的,然后micro_batch_size 是4, 好像我记得默认也是4, batch_size 我没改

讲道理load_in_8bit=True的话,v100跑个程序应该会报错啊,我是一直报错的,后面改成了load_in_8bit=False 才正常,然后用了.half()来记载模型训练,否则32Gv100会报oom

请问是将finetune.py的这部分这样修改吗? image

from chinese-vicuna.

alisyzhu avatar alisyzhu commented on May 18, 2024

我没有用8个v100, 我是两个啊, 一个v100 是32G的, 是你这样改的,然后micro_batch_size 是4, 好像我记得默认也是4, batch_size 我没改

讲道理load_in_8bit=True的话,v100跑个程序应该会报错啊,我是一直报错的,后面改成了load_in_8bit=False 才正常,然后用了.half()来记载模型训练,否则32Gv100会报oom

请问是将finetune.py的这部分这样修改吗? image

好的,我试试,感谢。我想问问你之前load_in_8bit=True的时候,v100报错是什么呀?我也有bug信息,但是能执行fine-tune,就是loss不对;可是我换成A100,好像bug信息也没变,但是按照硬件信息,A100是支持8int的呀 ~

from chinese-vicuna.

rookiebird avatar rookiebird commented on May 18, 2024

我没有用8个v100, 我是两个啊, 一个v100 是32G的, 是你这样改的,然后micro_batch_size 是4, 好像我记得默认也是4, batch_size 我没改

讲道理load_in_8bit=True的话,v100跑个程序应该会报错啊,我是一直报错的,后面改成了load_in_8bit=False 才正常,然后用了.half()来记载模型训练,否则32Gv100会报oom

请问是将finetune.py的这部分这样修改吗? image

好的,我试试,感谢。我想问问你之前load_in_8bit=True的时候,v100报错是什么呀?我也有bug信息,但是能执行fine-tune,就是loss不对;可是我换成A100,好像bug信息也没变,但是按照硬件信息,A100是支持8int的呀 ~

没报错,看上去是个奇怪的bug, 但是我马上反应过来可能是load_in_8bit设置为True了,改了就好了,我推理的时候,generate.py 设置load_in_8_bit也不会报错

from chinese-vicuna.

Facico avatar Facico commented on May 18, 2024

@alisyzhu 把prepare_model_for_int8_training(model)去掉,然后在get_peft_model之后加上model.half()试试

from chinese-vicuna.

alisyzhu avatar alisyzhu commented on May 18, 2024

我没有用8个v100, 我是两个啊, 一个v100 是32G的, 是你这样改的,然后micro_batch_size 是4, 好像我记得默认也是4, batch_size 我没改

讲道理load_in_8bit=True的话,v100跑个程序应该会报错啊,我是一直报错的,后面改成了load_in_8bit=False 才正常,然后用了.half()来记载模型训练,否则32Gv100会报oom

请问是将finetune.py的这部分这样修改吗? image

好的,我试试,感谢。我想问问你之前load_in_8bit=True的时候,v100报错是什么呀?我也有bug信息,但是能执行fine-tune,就是loss不对;可是我换成A100,好像bug信息也没变,但是按照硬件信息,A100是支持8int的呀 ~

没报错,看上去是个奇怪的bug, 但是我马上反应过来可能是load_in_8bit设置为True了,改了就好了,我推理的时候,generate.py 设置load_in_8_bit也不会报错

请问是这种bug信息吗?
image

我按照上面改了model的half部分,但还是OOM,哭了 ~

from chinese-vicuna.

alisyzhu avatar alisyzhu commented on May 18, 2024

@alisyzhu 把prepare_model_for_int8_training(model)去掉,然后在get_peft_model之后加上model.half()试试

还是不行,
image
image
image

from chinese-vicuna.

alisyzhu avatar alisyzhu commented on May 18, 2024

是不是load_in_8bit=False了,v100就跑不了13B的模型了。。。一直OOM

from chinese-vicuna.

Facico avatar Facico commented on May 18, 2024

@alisyzhu 我们没拿V100跑过。粗略估算,7B+8bit差不多是1B1G,13B+16bit可能就是1B4G,你可以拿之前开8bit(虽然会有问题)的显存*2算算。

如果实在需要跑,需要使用deepspeed+zero2/3 offload的技术,在huggingface的trainer上很好加,你可以试试(可以参考这些博客)。由于使用zero offload代码会跑的很慢,当时我们就没有考虑,如果之后有需求会加上的。或者如果你成功加上跑上了,我们也会非常感谢你的贡献。

from chinese-vicuna.

Facico avatar Facico commented on May 18, 2024

@alisyzhu 我好像忘记问你mirco batch size开的多少了,你可以试试开到1

from chinese-vicuna.

lucasjinreal avatar lucasjinreal commented on May 18, 2024

v100 7B是可以训练的,只是int8太慢了(可能是huggface里面int8很慢)。
可以训的组合是 fp16 load + deepspeed offload

from chinese-vicuna.

lyccyl1 avatar lyccyl1 commented on May 18, 2024

This may be due to hardware reasons. On some hardware, the quantization model is not compatible with fp16. You can try set fp16=False. It works for me.

from chinese-vicuna.

Related Issues (20)

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.