Skip to content

docs + research: NEW PPL RECORD 1.0040x, 18 archs validated, 9 HF uc-… #5

docs + research: NEW PPL RECORD 1.0040x, 18 archs validated, 9 HF uc-…

docs + research: NEW PPL RECORD 1.0040x, 18 archs validated, 9 HF uc-… #5

Workflow file for this run

name: Tests
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install transformers numpy scipy tqdm
- name: Import test (all modules)
run: |
python -c "
import importlib, os, sys
sys.path.insert(0, '.')
errors = []
for f in sorted(os.listdir('ultracompress')):
if f.endswith('.py') and f != '__init__.py':
mod = f[:-3]
try:
importlib.import_module(f'ultracompress.{mod}')
except Exception as e:
errors.append((mod, str(e)))
if errors:
print(f'{len(errors)} modules failed to import:')
for mod, err in errors:
print(f' {mod}: {err}')
else:
print(f'All modules imported successfully!')
# Don't fail on import errors for now (some need GPU)
"
- name: Unit tests (CPU)
run: |
python -c "
import torch
from ultracompress.moonshot import FractalBlock, FractalModel
# Test FractalBlock
block = FractalBlock(256, 4, ff_mult=1)
x = torch.randn(1, 8, 256)
gamma = torch.ones(256)
beta = torch.zeros(256)
out = block(x, gamma, beta)
assert out.shape == x.shape, f'Block output shape mismatch: {out.shape}'
print('FractalBlock: OK')
# Test FractalModel
model = FractalModel(256, 4, 2, 4, 1000, 1)
tokens = torch.randint(0, 1000, (1, 8))
logits = model(tokens)
assert logits.shape == (1, 8, 1000), f'Model output shape: {logits.shape}'
print('FractalModel: OK')
# Test return_hidden
logits, hidden = model(tokens, return_hidden=True)
assert len(hidden) == 8, f'Expected 8 hidden states, got {len(hidden)}'
print('return_hidden: OK')
print('All tests passed!')
"