Skip to content

armgit / Edge0

Public Imported from GitHub
0

Run 35B MoE models in ~2.5 GB of RAM. Weights stream from SSD; a trained router predicts loads a step ahead. Mac, iPhone, Android, Windows supported

Python
1.6 KB
Raw Blame
// catalog.rs — embedded tier table, generated by tools/make_app_catalog.py.
// The UI must not hardcode model sizes/sha; this is the single source of truth.
use serde::Deserialize;
use serde_json::Value;
use std::collections::HashMap;

pub const CAT_JSON: &str = include_str!("../catalog.json");

#[derive(Debug, Clone, Deserialize)]
pub struct CatFile {
    pub path: String,
    pub size: u64,
    pub sha256: String,
    #[serde(default)]
    pub skip: bool,
}

#[derive(Debug, Clone, Deserialize)]
pub struct Rev {
    pub modelscope: String,
    pub hf: String,
}

#[derive(Debug, Clone, Deserialize)]
pub struct Tier {
    pub repo: String,
    pub rev: Rev,
    pub files: Vec<CatFile>,
    pub total_bytes: u64,
    pub pool_mb: u32,
}

pub fn catalog() -> HashMap<String, Tier> {
    serde_json::from_str(CAT_JSON).expect("catalog.json parse failed (rerun tools/make_app_catalog.py)")
}

pub fn catalog_value() -> Value {
    serde_json::from_str(CAT_JSON).unwrap()
}

pub fn base_urls(tier: &Tier) -> Vec<(&'static str, String)> {
    // Source order for the overseas release: HuggingFace first; hf-mirror and
    // modelscope are fallbacks (mainland users configure their own proxy — network
    // routing is not the app's job). All three still participate in the probe-speed
    // race, so the fastest reachable source wins at runtime.
    vec![
        ("hf", format!("https://huggingface.co/{}/resolve/{}", tier.repo, tier.rev.hf)),
        ("hf-mirror", format!("https://hf-mirror.com/{}/resolve/{}", tier.repo, tier.rev.hf)),
        ("modelscope", format!("https://modelscope.cn/models/{}/resolve/{}", tier.repo, tier.rev.modelscope)),
    ]
}