File size: 1,345 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 | """Import the complete inference graph and build the UI without model weights."""
import json
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
from settings import CODE
sys.path.insert(0, str(CODE))
if __name__ == "__main__":
import torch
import torchaudio
import transformers
import diffusers
from model.anyToImageVideoAudio import NextGPTModel
from model.ImageBind.data import BPE_PATH
from model.ImageBind.models.multimodal_preprocessors import SimpleTokenizer
if not torchaudio.list_audio_backends():
raise RuntimeError("No audio decoding backend: install soundfile.")
tokenizer = SimpleTokenizer(bpe_path=BPE_PATH)
tokens = tokenizer("A short multimodal test")
if tokens.numel() == 0:
raise RuntimeError("ImageBind tokenizer produced no tokens.")
import app
if not app.demo.config.get("components"):
raise RuntimeError("Gradio UI has no components.")
print(json.dumps({"import_smoke": "passed", "torch": torch.__version__,
"transformers": transformers.__version__, "diffusers": diffusers.__version__,
"cuda_available": torch.cuda.is_available(), "model_weights_loaded": False,
"ui_components": len(app.demo.config["components"])}))
|