File size: 1,096 Bytes
b49bf13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Filesystem contract for the original NExT-GPT v0 checkpoints."""
from pathlib import Path
import os

MODEL_ROOT = Path(os.environ.get("MODEL_ROOT", "models")).resolve()
BASE = MODEL_ROOT / "llama-7b"
DELTA = MODEL_ROOT / "vicuna-7b-delta-v0"
VICUNA = MODEL_ROOT / "pretrained_ckpt" / "vicuna_ckpt" / "7b_v0"
IMAGEBIND = MODEL_ROOT / "pretrained_ckpt" / "imagebind_ckpt" / "huge" / "imagebind_huge.pth"
NEXTGPT = MODEL_ROOT / "delta_ckpt" / "nextgpt" / "7b_tiva_v0" / "pytorch_model.pt"


def missing_for_inference() -> list[str]:
    required = {
        "restored Vicuna v0 config": VICUNA / "config.json",
        "restored Vicuna v0 tokenizer": VICUNA / "tokenizer.model",
        "ImageBind huge": IMAGEBIND,
        "NExT-GPT 7b_tiva_v0 checkpoint": NEXTGPT,
    }
    missing = [name for name, path in required.items() if not path.is_file()]
    # FastChat may leave a config file behind when merging is interrupted.
    if not any(VICUNA.glob("pytorch_model*.bin")) and not any(VICUNA.glob("model*.safetensors")):
        missing.append("restored Vicuna v0 weights")
    return missing