Skip to main content

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.

imgkl

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 some custom parameters
quick_llm.finetune(
    objective="chat",              # Objective could be 'chat', 'code', 'specific_chat', etc.
    epochs=5,                      # Number of training epochs
    learning_rate=3e-5,            # Learning rate
    train_split=0.7,               # Train-validation split ratio
    validation_split=0.15,         # Validation split ratio
    save_steps=250,                # Save model every 250 steps
    eval_steps=250,                # Evaluate model every 250 steps
    quantization="4bit",           # or "8bit", or None for no quantization
    resource_utilization=0.8,      # Use 80% of available resources
    optimization_target="balanced" # or "speed" or "accuracy"
)

# 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!

Metadata

Release files for quickllm 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quickllm 1.0.1
File Size Uploaded
quickllm-1.0.1.tar.gz 12.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for quickllm 1.0.1
File Interpreter ABI Platform
quickllm-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 25.9 kB

Release files / quickllm-1.0.1.tar.gz

Download URL quickllm-1.0.1.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3f37d7d42c9a1b06dc271f08ca658fc8dd6f31ea7f913b763cdcf4927590d1bd
BLAKE2b-256 checksum
How to use checksums
8ff3dcb5758032e4f9850decaff6a4cd3cf795c7a3de1ceaedc97ba0b74c3904
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / quickllm-1.0.1-py3-none-any.whl

Download URL quickllm-1.0.1-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38ba6d810923667ea188bca8ce7ce2b062004542faff67973f58b033ab4fabd6
BLAKE2b-256 checksum
How to use checksums
36515ace1ed288e5b993b0e80558e3b729eac98c763a5766f98423bdecf31af2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page