Skip to main content

A library for quick fine-tuning and interaction with popular language models

Project description

QuickLLM: Quick and Easy Fine-tuning for Popular Language Models and Interaction

A Python package called QuickLLM was created to make dealing with, adjusting, and visualizing large language models (LLMs) easier. It provides both novices and experts with an easy-to-use API that lets you quickly train your models on unique text data, communicate with them, see inside of them, and even interact with them through a graphical user interface.

Features

  • Fine-tune popular language models on custom datasets
  • Optimize models for specific tasks like chat, code generation, or domain-specific conversations
  • Visualize model parameters and training progress
  • Interactive chat interface with fine-tuned models
  • Support for a wide range of popular language models

Installation

You can install QuickLLM using pip:

pip install quickllm

Quick Start

Minimal Example: Fine-Tuning and Chatting with a Model Here's how you can fine-tune a model on your text data and start chatting with it:

from quickllm import QuickLLM

# Initialize QuickLLM with your desired model and dataset
quick_llm = QuickLLM(model_name="gpt2", input_file="data/train.txt", output_dir="output/")

# Fine-tune the model
quick_llm.finetune(objective="chat")

# Chat with the model
response = quick_llm.chat("Hello, how are you?")
print("Model:", response)

Advanced Example: Utilizing All Features This example demonstrates fine-tuning a model, visualizing its internals, and interacting via a GUI:

from quickllm import QuickLLM

# Initialize QuickLLM with your desired model and dataset
quick_llm = QuickLLM(model_name="gpt2-medium", input_file="data/train.txt", output_dir="output/")

# Fine-tune the model with custom parameters
quick_llm.finetune(objective="chat", epochs=5, learning_rate=3e-5, save_steps=100)

# Visualize the model's internals and training progress
quick_llm.visualize()

# Start a command-line chat session
response = quick_llm.chat("What's the weather like today?")
print("Model:", response)

# Start the GUI chat interface
quick_llm.start_gui()

Supported Models

QuickLLM supports a wide range of popular language models. Here's a list of currently available models:

  1. GPT Family:

    • gpt2
    • gpt2-medium
    • gpt2-large
    • gpt2-xl
  2. LLaMA Family:

    • llama
    • llama2
    • llama2-7b
    • llama2-13b
    • llama2-70b
  3. BERT Family:

    • bert-base-uncased
    • bert-large-uncased
    • roberta-base
    • roberta-large
  4. T5 Family:

    • t5-small
    • t5-base
    • t5-large
  5. BART Family:

    • facebook/bart-base
    • facebook/bart-large
  6. GPT-Neo Family:

    • EleutherAI/gpt-neo-125M
    • EleutherAI/gpt-neo-1.3B
    • EleutherAI/gpt-neo-2.7B
  7. GPT-J Family:

    • EleutherAI/gpt-j-6B
  8. OPT Family:

    • facebook/opt-125m
    • facebook/opt-350m
    • facebook/opt-1.3b
  9. BLOOM Family:

    • bigscience/bloom-560m
    • bigscience/bloom-1b1
    • bigscience/bloom-1b7
  10. Other Models:

    • microsoft/DialoGPT-medium
    • facebook/blenderbot-400M-distill

You can use any of these models by specifying the model name when initializing QuickLLM. More comming soon

Fine-tuning Objectives

QuickLLM supports different fine-tuning objectives to optimize the model for specific tasks:

  • chat: General conversational fine-tuning
  • code: Optimize for code generation tasks
  • specific_chat: Fine-tune for domain-specific conversations based on your input data

Visualization Capabilities

QuickLLM can generate various visualizations, including:

  • Model Architecture: Visualize the model's layers and components.
  • Parameter Sizes: Bar plots showing the size of each layer's parameters.
  • Attention Heads: Distribution of attention heads across model layers.
  • Training Metrics: Graphs of training and validation loss, learning rate schedules.
  • Token Embeddings: t-SNE plots of token embeddings, annotated with interesting tokens.

Example Visualizations

After fine-tuning, you can visualize your model's architecture, parameters, and training progress with the following command:

quick_llm.visualize()

Visualizations are saved in the specified output_dir as PNG files.

GUI Chat Interface

QuickLLM includes a graphical user interface (GUI) for interacting with your models. To start the GUI:

quick_llm.start_gui()

This launches a window where you can load a model, chat with it, and view the chat history.

Contributing

We welcome contributions to QuickLLM! Please feel free to submit issues, fork the repository and send pull requests!

License

QuickLLM is released under the MIT License. See the LICENSE file for more details.

Contact

If you have any questions, feel free to reach out to me at supersidhant10@gmail.com or open an issue on our GitHub repository.

Happy fine-tuning!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quickllm-0.1.10.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

quickllm-0.1.10-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file quickllm-0.1.10.tar.gz.

File metadata

  • Download URL: quickllm-0.1.10.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for quickllm-0.1.10.tar.gz
Algorithm Hash digest
SHA256 e1e2d36f307150c0f461ce6c1ceae9cf7d28678892f2e88bf1f129429373d53c
MD5 670db1eb9c55254a85eb363e22d81513
BLAKE2b-256 9b938d1374250782460eaaf4c3d0af202c54b0ad74526500d029823f350e1f0c

See more details on using hashes here.

File details

Details for the file quickllm-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: quickllm-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for quickllm-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 cdc6271802bfda7c9e802178d3490a17e04e6c6394c430098585f37cfcd5de4d
MD5 9f39967a0626ca09222d39e8663eb198
BLAKE2b-256 b67557817207d6c5342a35856b31a55f47bfb2958509aa8da6aedd007ffb8fd2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page