28 lines
1.9 KiB
Python
28 lines
1.9 KiB
Python
import unittest
|
|
from execution_setup import assess
|
|
from profiles import QWEN_REPO,FLUX_REPO
|
|
from tts_runtime import REPO,REVISION
|
|
class ExecutionSetupTests(unittest.TestCase):
|
|
def check(self,kind,repo,file,installed=None,**extra):return assess(dict(kind=kind,repo=repo,file=file,**extra),installed or {})
|
|
def test_unknown_and_asr_not_llama(self):
|
|
for kind in ['stt','music','voice','video','image','audio']:
|
|
self.assertEqual(self.check(kind,'other/model','model.gguf')['state'],'unsupported')
|
|
def test_images_reuse_runtime_but_need_components(self):
|
|
for repo,file in [(QWEN_REPO,'model.gguf'),(FLUX_REPO,'Flux.2 Klein-9B_fp16_nsfw.safetensors')]:
|
|
r=self.check('image',repo,file,{'image':True});self.assertEqual(r['state'],'setup');self.assertEqual(len(r['components']),2)
|
|
self.assertEqual(self.check('image',repo,file)['state'],'runtime_missing')
|
|
def test_tts_exact_revision_no_silent_replacement(self):
|
|
self.assertEqual(self.check('audio',REPO,'model.safetensors',revision=REVISION)['state'],'runtime_missing')
|
|
self.assertEqual(self.check('audio',REPO,'model.safetensors',revision='other')['state'],'unsupported')
|
|
self.assertIn('alternative',self.check('audio','mlx-community/base','model.safetensors'))
|
|
def test_components(self):
|
|
for file in ['mmproj.gguf','vae/model.safetensors','speech_tokenizer/model.safetensors','config.json']:
|
|
self.assertEqual(self.check('audio',REPO,file)['state'],'component')
|
|
def test_chat_is_candidate_not_guarantee(self):
|
|
self.assertEqual(self.check('chat','a/b','model.gguf',{'chat':True})['state'],'check')
|
|
self.assertEqual(self.check('chat','a/b','model.safetensors')['state'],'unsupported')
|
|
def test_profile_blockers_and_ready(self):
|
|
model=dict(kind='image',repo=QWEN_REPO,file='model.gguf')
|
|
self.assertEqual(assess(model,{'image':True},dict(runnable=False,blockers=['VAE fehlt']))['state'],'profile_incomplete')
|
|
self.assertEqual(assess(model,{'image':True},dict(runnable=True))['state'],'ready')
|