Skip to content

Instantly share code, notes, and snippets.

@lewtun
lewtun / sft_llama.py
Last active November 9, 2024 02:33
SFT Llama 3.1 8B - full training vs LoRA vs QLoRA
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
import time
from datetime import timedelta
from datasets import load_dataset
from txtai import LLM
from txtai.pipeline import Labels, HFTrainer
def prompt(text):
text = f"""
@mlabonne
mlabonne / YALL - Yet Another LLM Leaderboard.md
Last active April 20, 2025 19:52
Leaderboard made with 🧐 LLM AutoEval (https://github.com/mlabonne/llm-autoeval) using Nous benchmark suite.
@mlabonne
mlabonne / merge_peft.py
Last active March 3, 2025 05:36
Merge base model and peft adapter and push it to HF hub
# Example usage:
# python merge_peft.py --base_model=meta-llama/Llama-2-7b-hf --peft_model=./qlora-out --hub_id=alpaca-qlora
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
import argparse
def get_args():