Skip to content

Instantly share code, notes, and snippets.

@fakerybakery
fakerybakery / hf_zipper.py
Last active March 22, 2025 18:08
HF Zipper
import os
import shutil
import tempfile
import click
import subprocess
from huggingface_hub import snapshot_download
@click.command()
@click.argument('repo_id')
@click.argument('zip_path')
@fakerybakery
fakerybakery / mistral-convert.py
Last active March 24, 2025 10:36
Convert the text portion of Mistral 3.1 -> HF format (IMPORTANT: Does not convert vision layers yet! The resulting model will be a text-only LLM.)
# Copyright 2023 Mistral AI and 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,
@fakerybakery
fakerybakery / upload.py
Created December 30, 2023 00:15
Hugging Face Hub: Upload in pure Python, with only the Requests & JSON libraries!
FILE_CONTENTS = 'File Contents'
REPO_TYPE = 'dataset'
REPO_ID = 'username/repo'
HF_TOKEN = 'hf_***'
import requests
import json
import base64
x = [
@fakerybakery
fakerybakery / electron.html
Created June 19, 2023 20:56
Run inline code (electron)
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';">
@fakerybakery
fakerybakery / emojis.json
Last active March 11, 2023 18:44
PHP Emoji Array Generator - GitHub Emoji - Generate an array of emojis and corresponding names!
{
"+1": "https://github.githubassets.com/images/icons/emoji/unicode/1f44d.png?v8",
"-1": "https://github.githubassets.com/images/icons/emoji/unicode/1f44e.png?v8",
"100": "https://github.githubassets.com/images/icons/emoji/unicode/1f4af.png?v8",
"1234": "https://github.githubassets.com/images/icons/emoji/unicode/1f522.png?v8",
"1st_place_medal": "https://github.githubassets.com/images/icons/emoji/unicode/1f947.png?v8",
"2nd_place_medal": "https://github.githubassets.com/images/icons/emoji/unicode/1f948.png?v8",
"3rd_place_medal": "https://github.githubassets.com/images/icons/emoji/unicode/1f949.png?v8",
"8ball": "https://github.githubassets.com/images/icons/emoji/unicode/1f3b1.png?v8",
"a": "https://github.githubassets.com/images/icons/emoji/unicode/1f170.png?v8",