stsachit's picture
Publish self-contained A10 deployment and offline validation
52a6059 verified
Raw History Blame Contribute Delete
918 Bytes
"""Dependency-free model pins and environment resolution for Modal and HF."""
import os
from dataclasses import dataclass
UPSTREAM = 'socialtrait/flux-3-image-klein-infendpoint'
REVISION = '5cda60397ebe10a0e2e7a68598ffbb06e8eb16df'
GGUF_FILENAME = 'transformer/flux-3-image-klein-Q8_0.gguf'
@dataclass(frozen=True)
class Settings:
model_id: str = UPSTREAM
revision: str = REVISION
quantization: str = 'q8_0'
@classmethod
def from_env(cls):
repo = os.getenv('FLUX_MODEL_ID', UPSTREAM)
# A private copy has different commits; don't reuse the upstream SHA.
revision = os.getenv('FLUX_MODEL_REVISION', REVISION if repo == UPSTREAM else 'main')
return cls(repo, revision, os.getenv('FLUX_QUANTIZATION', 'q8_0'))
def __post_init__(self):
if self.quantization not in ('bf16', 'q8_0'):
raise ValueError('FLUX_QUANTIZATION must be bf16 or q8_0')