Giter Club home page Giter Club logo

bitnet158b's Introduction

論文に書かれていたBitNet1.58bのBitLinear部の実装です。
https://arxiv.org/abs/2310.11453
https://arxiv.org/abs/2402.17764

論文を読み自力で書いたところもありますが、以下の方々のコードが非常に参考になりました。
https://github.com/Beomi/BitNet-Transformers
https://github.com/frodo821/BitNet-Transformers
https://github.com/kyegomez/BitNet

参考にさせてもらったコードから大きな変更点としては、activationの順番とdeqauntizeの部分を直しています。
また、Beomiさんのコードのllamaに追加してみたところ、epoch60000でlossは3.7付近でした。


実験1:int8への変換 少し試してみましたが、matmal時に"addmm_cuda" not implemented for 'Char'となってしまうため実装できません。CPUで動かしてみましたが、あまりの遅さで実験できませんでした。仕方ないのでroundをして四捨五入してみましたが、メモリ使用量は変化ありませんでした。 補足1:torch.compile
自作したGPTではtorch.compileはmatmal後に2の累乗以外をかけるとlossがnanになりました。ところがllamaだと問題ないようです。

補足2:モデルサイズと学習率について
モデルサイズを大きくするとともに、論文通りに、あるいはそれよりさらに学習率を下げたほうが良さそうです。

補足3:上記のllamaのweightの保存時でエラーが出る
epoch67892でBeomiさんのコードとの相性で止まってしまいますが、bitnetの感覚はつかめると思います。
line 893あたりの保存設定を変えればなんとかなりそうですが、llamaに詳しくないため現在対処が難しいです。
時間があったらその部分にも挑戦します。

bitnet158b's People

Contributors

suito555 avatar

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.