Skip to content

Instantly share code, notes, and snippets.

@sparverius
sparverius / finetune_llama_v2.py
Created October 16, 2023 19:41 — forked from younesbelkada/finetune_llama_v2.py
Fine tune Llama v2 models on Guanaco Dataset
# coding=utf-8
# 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
diff --git a/AutoGPTQ/auto_gptq/utils/peft_utils.py b/qa-lora/peft_utils.py
index 46850d0..2b4682e 100644
--- a/AutoGPTQ/auto_gptq/utils/peft_utils.py
+++ b/qa-lora/peft_utils.py
@@ -16,6 +16,9 @@ from peft.utils.other import _get_submodules
 from ..modeling._base import BaseGPTQForCausalLM
 
 
+group_size = 32  # quantization group_size
{
"model": "Model",
"model.embed_tokens": "Embedding",
"model.embed_tokens.weight": {"shape": [32000, 4096], "dtype": "float16"},
"model.layers": "ModuleList",
"model.layers.0": "DecoderLayer",
"model.layers.0.self_attn": "Attention",
"model.layers.0.self_attn.rotary_emb": "RotaryEmbedding",
"model.layers.0.self_attn.rotary_emb.inv_freq": {"shape": [64], "dtype": "float32"},
"model.layers.0.self_attn.rotary_emb.cos_cached": {"shape": [1, 1, 4096, 128], "dtype": "float16"},
@sparverius
sparverius / min-char-rnn.py
Created June 8, 2020 14:12 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@datacon(Stream)
def filter(xs):
@fnx
def auxmain(xs): lazy(auxloop(eval(xs)))
def auxloop(xs):
match xs:
for nil: return nil
for cons(x, xs):
match filter.test(x):
for tt: return cons(x, auxmain(xs))
@sparverius
sparverius / bcopy.dtal.asm
Last active September 20, 2023 13:12
Dependently Typed Assembly Language
(*
void bcopy(int src[], int dst[]) {
int l = 0;
int i = 0;
if(length(src) > length(dst))
l = length (dst);
else
l = length (src);
git clone https://github.com/xanadu-lang/xinterp.git
cd xinterp
sh build.sh
from qiskit import Aer, IBMQ, execute, QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit.transpiler import CouplingMap
from qiskit.tools.monitor import job_monitor
from qiskit.providers.aer import noise
from qiskit.providers.aer.noise.errors import depolarizing_error
# Construct quantum circuit
qr = QuantumRegister(3, 'qr')
cr = ClassicalRegister(3, 'cr')
circ = QuantumCircuit(qr, cr)
#include "share/atspre_staload.hats"
vtypedef llist(a:vt@ype) = List_vt(a)
extern fun{fa,a0:vt0p}{fb,b0:vt0p}
monad_bind: (!fa) -> fb
extern fun{a0:vt0p}{fb,b0:vt0p}
monad_bind$f: (!a0) -> fb
#include "share/atspre_staload.hats"
vtypedef llist(a:vt@ype) = List_vt(a)
extern fun{fa,a0:vt0p}{fb,b0:vt0p}
monad_bind: (!fa) -> fb
extern fun{a0:vt0p}{fb,b0:vt0p}
monad_bind$f: (!a0) -> fb