Giter VIP home page Giter VIP logo

berkshiregpt's Introduction

BerkshireGPT: A Large Language Model Trained to Value Invest


Introduction

This is a 7 billion parameter language model based on the Llama2 architecture. It was trained on the Berkshire Hathaway annual letters to shareholders from 2004 to 2021. The model was trained using Lora fine-tuning. I have also released an MLX version for optimized inference on Mac computers.

BerkshireGPT Model Card MLX Version

Training Data and Process

The model was trained on the annual letters to shareholders from 2004 to 2021. The letters were obtained from the Berkshire Hathaway website. The letters were preprocessed to remove any non-ASCII characters and then tokenized using the Hugging Face tokenizers library. The model was trained using the Lora fine-tuning method. The model was trained on Kaggle using their notebooks and available GPUs. It took about a hour and a half to train for 300 steps.

Usage

The model can be used for a variety of tasks such as text generation, summarization, and question answering. The model can be used with the Hugging Face Transformers library or mlx if you have an apple computer.

The inference.ipynb notebook can run on any device but is optimized for cuda gpus.

Updates

  • Added mlx support for gradio engine. Still has some bugs though but it works.
  • MLX llama index rag code is from this repository.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig, TextStreamer

name = "dwightf/BerkshireGPT"
     
bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_use_double_quant=False,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.float16
)

model = AutoModelForCausalLM.from_pretrained(name, quantization_config=bnb_config)
tokenizer = AutoTokenizer.from_pretrained(name)

Scripts are available in the scripts folder to help with using the model. There are inference and RAG scripts.

You can run inference with BitsAndBytes quantization on a GPU with only 8GB of memory

You can run the gradio demo with the following command:

python gradio_scripts/run.py

Future Work

Benchmark the model

Create rag and gradio optimized for apple mlx.

I will also be releasing colab notebooks soon and hopefully the dataset I used.

Acknowledgements

I would like to thank the creators of this repository for helping me fine-tune the model.

I would also like to thank the creators of this repository for the RAG code.

I would also like to thank the creators of the llm I used as a base model found here.

Contact

If you have any questions or would like to collaborate, please feel free to reach out to me at [email protected]

License

This model is licensed under the MIT License. You may use it for commercial and non-commercial use.

Reminder

This model is just for testing and educational purposes. It should not be used for making financial decisions and is not financial advice.

berkshiregpt's People

Contributors

dwight-foster avatar

Stargazers

 avatar

Watchers

 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.