Skip to content

Instantly share code, notes, and snippets.

View duskfallcrew's full-sized avatar
🏠
Working from home in my brain somewhere

The Duskfall Portal Crew duskfallcrew

🏠
Working from home in my brain somewhere
View GitHub Profile
@Tumppi066
Tumppi066 / convertToSafeTensor.py
Last active October 17, 2025 10:57
Convert all .ckpt files in all subdirectories to .safetensors files
# Got a bunch of .ckpt files to convert?
# Here's a handy script to take care of all that for you!
# Original .ckpt files are not touched!
# Make sure you have enough disk space! You are going to DOUBLE the size of your models folder!
#
# First, run:
# pip install torch torchsde==0.2.5 safetensors==0.2.5
#
# Place this file in the **SAME DIRECTORY** as all of your .ckpt files, open a command prompt for that folder, and run:
# python convert_to_safe.py
@Narsil
Narsil / pure_torch.py
Created November 10, 2022 15:06
Loading a safetensors file with pure torch only
import mmap
import torch
import json
import os
from huggingface_hub import hf_hub_download
def load_file(filename, device):
with open(filename, mode="r", encoding="utf8") as file_obj:
with mmap.mmap(file_obj.fileno(), length=0, access=mmap.ACCESS_READ) as m:
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active December 11, 2025 07:53
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux