Skip to content

Instantly share code, notes, and snippets.

View GrHalbgott's full-sized avatar
🐣
Navigating geospatial complexity with confident confusion since 2021.

Niko Kolaxidis GrHalbgott

🐣
Navigating geospatial complexity with confident confusion since 2021.
View GitHub Profile
@philschmid
philschmid / get_memory_size.py
Created January 16, 2025 13:53
Get needed GPU per precision for a Hugging Face Model Id
from typing import Dict, Union
from huggingface_hub import get_safetensors_metadata
import argparse
import sys
# Example:
# python get_gpu_memory.py Qwen/Qwen2.5-7B-Instruct
# Dictionary mapping dtype strings to their byte sizes
bytes_per_dtype: Dict[str, float] = {
@jannismain
jannismain / CompactJSONEncoder.py
Last active April 23, 2025 15:08
A JSON Encoder in Python, that puts small lists on single lines.
#!/usr/bin/env python3
from __future__ import annotations
import json
class CompactJSONEncoder(json.JSONEncoder):
"""A JSON Encoder that puts small containers on single lines."""
CONTAINER_TYPES = (list, tuple, dict)