This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Determine the HUBDIR based on the environment variables | |
if [[ -n "$HF_HUB_CACHE" ]] | |
then HUBDIR="$HF_HUB_CACHE" | |
elif [[ -n "$HF_HOME" ]] | |
then HUBDIR="$HF_HOME/hub" | |
else HUBDIR="$HOME/.cache/huggingface/hub/" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import LlamaConfig as LC, LlamaForCausalLM as LLM, LlamaTokenizer as LT | |
from accelerate import init_empty_weights, load_checkpoint_and_dispatch | |
import torch | |
lt = LT.from_pretrained("NousResearch/Llama-2-7b-hf") | |
c = LC.from_pretrained("NousResearch/Llama-2-70b-hf") | |
c.max_position_embeddings = 32764 | |
c.rope_theta = 1000000 | |
with init_empty_weights(): m = LLM(c) | |
m = m.half().eval() | |
m.requires_grad_(False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gguf-py/scripts/gguf-dump.py b/gguf-py/scripts/gguf-dump.py | |
index dbf89150..eeea947f 100755 | |
--- a/gguf-py/scripts/gguf-dump.py | |
+++ b/gguf-py/scripts/gguf-dump.py | |
@@ -24,6 +24,56 @@ def get_file_host_endian(reader: GGUFReader) -> tuple[str, str]: | |
file_endian = host_endian | |
return (host_endian, file_endian) | |
+from tqdm import tqdm | |
+import gguf.tensor_mapping as tm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
savepath = Path('mm') | |
savepath.mkdir(exist_ok=True) | |
import torch | |
import triton | |
from triton.ops.matmul import matmul as triton_matmul | |
#matmul = lambda a,b: _matmul.forward(a,b, acc_dtype=torch.float16, allow_tf32=True, output_dtype=torch.float16) # nightly | |
matmul = lambda a,b: triton_matmul(a,b, torch.float16) # stable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from unsloth import FastLlamaModel | |
from transformers import TrainingArguments | |
from datasets import load_dataset | |
from trl import DPOTrainer | |
model_name = "teknium/OpenHermes-2.5-Mistral-7B" | |
model_name = "./OpenHermes-2.5-Mistral-7B" | |
new_model = "NeuralHermes-2.5-Mistral-7B" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat OpenHermes-2.5-Mistral-7B/config.json | |
{ | |
"_name_or_path": "mistralai/Mistral-7B-v0.1", | |
"architectures": [ | |
"LlamaForCausalLM" | |
], | |
"bos_token_id": 1, | |
"eos_token_id": 32000, | |
"hidden_act": "silu", | |
"hidden_size": 4096, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' NOTE: | |
0. install pandas and numpy to run this | |
1. Download the data at https://docs.google.com/spreadsheets/d/1QtC8efWw0mVkGXW4QA9bX4f0nJhGbmFqCfVLSumMZ0I/edit **AS A CSV FILE** | |
2. **REMOVE THE FIRST LINE FROM THE CSV FILE BEFORE RUNNING THIS** | |
''' | |
import pandas as pd | |
import numpy as np | |
import re |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const tests = ["data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEA8ADwAAD/4RaQRXhpZgAATU0AKgAAAAgACQEPAAIAAAAGAAAAegEQAAIAAAAUAAAAgAESAAMAAAABAAEAAAEaAAUAAAABAAAAlAEbAAUAAAABAAAAnAEoAAMAAAABAAIAAAExAAIAAAAnAAAApAEyAAIAAAAUAAAAzIdpAAQAAAABAAAA4AAAApxDYW5vbgBDYW5vbiBFT1MgUkVCRUwgVDFpAAAknwAAACcQACSfAAAAJxBBZG9iZSBQaG90b3Nob3AgRWxlbWVudHMgOC4wIE1hY2ludG9zaAAAMjAxMDowNzoyNCAxNTo0MjoxNAAAG4KaAAUAAAABAAACKoKdAAUAAAABAAACMogiAAMAAAABAAEAAIgnAAMAAAABAMgAAJAAAAcAAAAEMDIyMZADAAIAAAAUAAACOpAEAAIAAAAUAAACTpIBAAoAAAABAAACYpICAAUAAAABAAACapIEAAoAAAABAAACcpIFAAUAAAABAAACepIHAAMAAAABAAUAAJIJAAMAAAABABAAAJIKAAUAAAABAAACgpKQAAIAAAADNTEAAJKRAAIAAAADNTEAAJKSAAIAAAADNTEAAKABAAMAAAABAAEAAKACAAQAAAABAABEeaADAAQAAAABAAAQ+6IOAAUAAAABAAACiqIPAAUAAAABAAACkqIQAAMAAAABAAIAAKQBAAMAAAABAAAAAKQCAAMAAAABAAEAAKQDAAMAAAABAAAAAKQGAAMAAAABAAAAAAAAAAAAAAABAAAAPAAAABYAAAABMjAxMDowNzoyMiAxNjoxMjo0MAAyMDEwOjA3OjIyIDE2OjEyOjQwAABaIcsAD0JAAIgXTwAPQkAAAAAAAAAAAQAADikAAAPoAAAAEgAAAAEASIKAAAADfgAwVwAAAAJRAAAABgEDAAMAAAABAAYAAAEaAAUAAAABAAAC6gEbAAUAAAABAAAC8gEoA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import idaapi | |
import idautils | |
import idc | |
import ida_kernwin | |
'''SAMPLE INPUT: | |
0x0000555555557f18│+0x0018: 0x00007ffff7f93500 → <seccomp_init+0> endbr64 | |
0x0000555555557f20│+0x0020: 0x00007ffff7da0430 → <__errno_location+0> endbr64 | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
script=/path/to/RsaCtfTool/RsaCtfTool.py | |
n=() | |
c=() | |
echo 'paste all n:' | |
for i in `seq 0 2` | |
do read | |
n[$i]=$REPLY | |
done | |
echo 'paste all c:' |