Skip to content

Instantly share code, notes, and snippets.

View mlabonne's full-sized avatar

Maxime Labonne mlabonne

View GitHub Profile
Model AGIEval GPT4All TruthfulQA Bigbench Average
zephyr-7b-alpha 38 72.24 56.06 40.57 51.72

AGIEval

Task Version Metric Value Stderr
agieval_aqua_rat 0 acc 20.47 ± 2.54
acc_norm 19.69 ± 2.50
agieval_logiqa_en 0 acc 31.49 ± 1.82
@mlabonne
mlabonne / YALL - Yet Another LLM Leaderboard.md
Last active November 9, 2025 19:21
Leaderboard made with 🧐 LLM AutoEval (https://github.com/mlabonne/llm-autoeval) using Nous benchmark suite.
@mlabonne
mlabonne / EvolCodeLlama-7b.yaml
Last active March 10, 2024 04:53
Axolotl config file to train mlabonne/EvolCodeLlama-7b (https://huggingface.co/mlabonne/EvolCodeLlama-7b)
base_model: codellama/CodeLlama-7b-hf
base_model_config: codellama/CodeLlama-7b-hf
model_type: LlamaForCausalLM
tokenizer_type: LlamaTokenizer
is_llama_derived_model: true
hub_model_id: EvolCodeLlama-7b
load_in_8bit: false
load_in_4bit: true
strict: false
@mlabonne
mlabonne / merge_peft.py
Last active May 29, 2025 13:58
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():
@mlabonne
mlabonne / finetune_llama2.py
Last active January 22, 2025 15:02
Easy Llama 2 fine-tuning script (📝 Article: https://tinyurl.com/finetunellama2)
# Based on younesbelkada/finetune_llama_v2.py
# Install the following libraries:
# pip install accelerate==0.21.0 peft==0.4.0 bitsandbytes==0.40.2 transformers==4.31.0 trl==0.4.7 scipy
from dataclasses import dataclass, field
from typing import Optional
import torch
from datasets import load_dataset
from transformers import (
@mlabonne
mlabonne / molora_7b_-proof_of_concept.ipynb
Last active July 27, 2023 17:25
molora_7b_-proof_of_concept.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mlabonne
mlabonne / temperature.py
Last active June 4, 2023 12:19
Shows the influence of temperature on the probabilities output by the softmax function
import numpy as np
import matplotlib.pyplot as plt
def softmax(x, temperature=1.0):
e_x = np.exp(x / temperature)
return e_x / e_x.sum(axis=0)
logits = np.array([1.5, -1.8, 0.9, -3.2])
temperatures = [1.0, 0.5, 0.1]
@mlabonne
mlabonne / gat_graph_classification.py
Created September 20, 2022 10:59
GAT architecture for graph classification with global_add_pool
import torch
import torch.nn.functional as F
from torch.nn import Linear, Sequential, BatchNorm1d, ReLU, Dropout
from torch_geometric.nn import GATConv
from torch_geometric.nn import global_add_pool
class GAT(torch.nn.Module):
def __init__(self, dim_h):
super(GAT, self).__init__()
obs = env_script.reset()
done = False
# 1. Get wood with the CNN
for i in tqdm(range(3000)):
obs = torch.from_numpy(obs['pov'].transpose(2, 0, 1)[None].astype(np.float32) / 255).cuda()
probabilities = torch.softmax(model(obs), dim=1)[0].detach().cpu().numpy()
action = np.random.choice(action_list, p=probabilities)
obs, reward, done, _ = env_script.step(action)
model = CNN((3, 64, 64), 7).cuda()
model.load_state_dict(torch.load('model.pth'))
env = gym.make('MineRLObtainDiamond-v0')
env1 = Recorder(env, './video', fps=60)
env = ActionShaping(env1)
action_list = np.arange(env.action_space.n)
obs = env.reset()