commit aa1f66bb163f11fd6d1d469500a3b224a54c8528
Author: Henry Unite <unitehenry@gmail.com>
Date: Wed, 10 Jun 2026 04:26:58 +0000
chore: init
Diffstat:
3 files changed, 106 insertions(+), 0 deletions(-)
diff --git a/compression.py b/compression.py
@@ -0,0 +1,59 @@
+import modal
+
+app = modal.App("compression")
+vol = modal.Volume.from_name("compression", create_if_missing=True)
+
+image = (
+ modal.Image.debian_slim()
+ .apt_install(["git", "wget", "tar"])
+ .run_commands(
+ [
+ "wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb",
+ "dpkg -i cuda-keyring_1.1-1_all.deb",
+ "apt-get update",
+ "apt-get -y install cuda-toolkit-12-8",
+ ]
+ )
+ .env({"PATH": "/usr/local/cuda/bin:$PATH"})
+ .run_commands(["mkdir /scripts"])
+ .add_local_file("scripts/smollm2", "/scripts/smollm2", copy=True)
+ .add_local_file("scripts/nacrith", "/scripts/nacrith", copy=True)
+ .run_commands(["chmod +x /scripts/smollm2", "/scripts/smollm2"])
+ .run_commands(["chmod +x /scripts/nacrith", "/scripts/nacrith"])
+)
+
+def run(commands):
+ import subprocess
+ import tempfile
+ import os
+
+ c = "\n".join(commands)
+
+ script = "\n".join(["#!/bin/bash", "set -e", "c"])
+
+ with tempfile.NamedTemporaryFile(mode="w", suffix=".sh", delete=False) as f:
+ f.write(script)
+ path = f.name
+
+ os.chmod(path, 0o755)
+
+ try:
+ subprocess.run(["/bin/bash", path], check=False)
+ finally:
+ os.unlink(path)
+
+@app.function(gpu="h100", image=image, volumes={ "/data": vol })
+def compress(file_name):
+ run([
+ "source /Nacrith-GPU/venv/bin/activate",
+ f'python /Nacrith-GPU/cli.py compress "/data/{file_name}" "/data/{file_name}.nc"',
+ ])
+
+@app.function(gpu="h100", image=image, volumes={ "/data": vol })
+def decompress(file_name):
+ outfile = "".join(file_path.rsplit(".nc", 1))
+
+ run([
+ "source /Nacrith-GPU/venv/bin/activate",
+ f'python /Nacrith-GPU/cli.py decompress "/data/{file_name}.nc" "/data/{outfile}"',
+ ])
diff --git a/scripts/nacrith b/scripts/nacrith
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+if [ ! -f smollm2-135m-f32.gguf ]; then
+ echo "Error: File smollm2-135m-f32.gguf does not exist." >&2
+ exit 1
+fi
+
+# Clone the repository
+git clone https://github.com/st4ck/Nacrith-GPU.git
+
+cp smollm2-135m-f32.gguf Nacrith-GPU
+
+cd Nacrith-GPU
+
+# Create and activate virtual environment
+python3 -m venv venv
+source venv/bin/activate
+
+# Install dependencies
+pip install torch
+pip install transformers accelerate numpy
+
+CMAKE_ARGS="-DGGML_CUDA=on" pip install llama-cpp-python --force-reinstall --no-cache-dir
diff --git a/scripts/smollm2 b/scripts/smollm2
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+# Clone llama.cpp
+git clone 'https://github.com/ggml-org/llama.cpp'
+cd llama.cpp
+
+# Create and activate virtual environment
+python3 -m venv venv
+source venv/bin/activate
+
+# Install llama.cpp dependencies
+pip install -r requirements.txt
+
+pip install huggingface_hub[cli]
+
+huggingface-cli download HuggingFaceTB/SmolLM2-135M-Instruct \
+ --local-dir SmolLM2-135M-Instruct \
+ --local-dir-use-symlinks False
+
+python convert_hf_to_gguf.py SmolLM2-135M-Instruct \
+ --outfile smollm2-135m-f32.gguf \
+ --outtype f32
+
+mv smollm2-135m-f32.gguf ../smollm2-135m-f32.gguf