File size: 1,762 Bytes
15c46ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""Paths and pinned upstream model sources; this module has no ML dependencies."""
import os
from pathlib import Path

ROOT = Path(__file__).resolve().parent
LEGACY = ROOT / "vendor" / "nextgpt"
CODE = LEGACY / "code"
WEIGHTS = Path(os.getenv("NEXTGPT_WEIGHTS", str(ROOT / "weights"))).resolve()
OUTPUTS = Path(os.getenv("NEXTGPT_OUTPUTS", str(ROOT / "outputs"))).resolve()
UPSTREAM_COMMIT = "60d618b067ee4cb0d70e7075ae79852780b34fc2"
MODELS = {
    "nextgpt": ("ChocoWu/nextgpt_7b_tiva_v0", "f28bea33714c810ef6cb9b9e440edcddb93297a4"),
    "llama": ("huggyllama/llama-7b", "4782ad278652c7c71b72204d462d6d01eaaf7549"),
    "vicuna_delta": ("lmsys/vicuna-7b-delta-v0", "fa5967d19dcc5d89c0a39d68766281ae6021e304"),
    "image": ("stable-diffusion-v1-5/stable-diffusion-v1-5", "451f4fe16113bff5a5d2269ed5ad43b0592e9a14"),
    "video": ("cerspense/zeroscope_v2_576w", "6963642a64dbefa93663d1ecebb4ceda2d9ecb28"),
    "audio": ("cvssp/audioldm-l-full", "26aec6fc5bb4f855a11e8357e0d69c8dc9d0ab95"),
}
IMAGEBIND_URL = "https://dl.fbaipublicfiles.com/imagebind/imagebind_huge.pth"


def weight_paths():
    return {
        "imagebind": WEIGHTS / "pretrained" / "imagebind_ckpt" / "huge" / "imagebind_huge.pth",
        "vicuna": WEIGHTS / "pretrained" / "vicuna_ckpt" / "7b_v0",
        "nextgpt": WEIGHTS / "nextgpt" / "pytorch_model.pt",
    }


def missing_weights():
    paths = weight_paths()
    missing = [key for key in ("imagebind", "nextgpt") if not paths[key].is_file()]
    vicuna = paths["vicuna"]
    if not ((vicuna / "config.json").is_file() and (vicuna / "tokenizer.model").is_file()
            and any(vicuna.glob("pytorch_model*.bin"))
            and (vicuna / "merge_complete.json").is_file()):
        missing.append("vicuna")
    return missing