implementing-llms-litgpt
Implements and trains LLMs using Lightning AI's LitGPT with 20+ pretrained architectures (Llama, Gemma, Phi, Qwen, Mistral). Use when need clean model implementations, educational understanding of architectures, or production fine-tuning with LoRA/QLoRA. Single-file
Installation
Pick a client and clone the repository into its skills directory.
Installation
About this skill
Implements and trains LLMs using Lightning AI's LitGPT with 20+ pretrained architectures (Llama, Gemma, Phi, Qwen, Mistral). Use when need clean model implementations, educational understanding of architectures, or production fine-tuning with LoRA/QLoRA. Single-file implementations, no abstraction layers.
How to use
Zainstaluj LitGPT za pomocą pip install 'litgpt[extra]' – to przygotuje wszystkie wymagane zależności (torch, transformers).
Pobierz wybrany model pretrenowany, na przykład Phi-2 poleceniem litgpt download microsoft/phi-2 lub Llama 3 8B poleceniem litgpt download meta-llama/Meta-Llama-3-8B. Modele zapisują się w katalogu checkpoints/.
Załaduj model w kodzie Pythona: from litgpt import LLM, następnie llm = LLM.load("microsoft/phi-2") – zastąp ścieżką do pobranego modelu.
Generuj tekst za pomocą metody generate() – podaj prompt, ustaw max_new_tokens (liczba tokenów do wygenerowania) i temperature (kontrola losowości odpowiedzi).
Aby dostosować model do swoich danych, przygotuj dataset w formacie Alpaca (instrukcja, input, output jako JSON) lub innym obsługiwanym formacie, a następnie uruchom fine-tuning za pomocą dostępnych skryptów treningowych z LitGPT.
Sprawdź dostępne modele poleceniem litgpt download list – zobaczysz pełną listę 20+ architektur, które możesz pobrać i użyć.