Unify component setup across categories and retain two installation backups
This commit is contained in:
@@ -24,3 +24,24 @@ class MusicComponentsTests(unittest.TestCase):
|
||||
for info in YUE2_COMPONENTS.values():
|
||||
for filename in info['files']:self.assertFalse(file_role(filename)['profile_eligible'])
|
||||
self.assertIsNone(music_recipe(dict(kind='music',repo='other/Yue2',file='yue2-3b-bf16.gguf')))
|
||||
def test_manual_setup_available_in_every_category_and_preserves_recipe(self):
|
||||
for kind in ('chat','image','audio','stt','music','voice','video'):
|
||||
model=dict(id='main',kind=kind,repo='unknown/model',file='weights.gguf',revision='a'*40)
|
||||
component=dict(id='aux',kind=kind,repo='external/repo',file='vae.safetensors',revision='b'*40,size=1)
|
||||
c=Mock();c.entry.side_effect=lambda id: {'main':model,'aux':component}[id]
|
||||
c.status.return_value=dict(entries=[component]);c.files.return_value=dict(repo='unknown/model',revision='a'*40,files=[],gated=False,url='https://huggingface.co/unknown/model',license=None)
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
p=Profiles(Path(d)/'profiles.json',c);p.rows=[dict(id='p',kind=kind,revision=1,name='Test',model_id='main',parameters={})]
|
||||
self.assertTrue(p.components('main')['manual'])
|
||||
p.assign(dict(id='p',revision=1,components={'manual_vae':'aux'}))
|
||||
self.assertEqual(p.rows[0]['components']['manual_vae'],'aux')
|
||||
self.assertTrue(p.references('aux'))
|
||||
with self.assertRaises(ValueError):p.assign(dict(id='p',revision=2,components={'arbitrary':'aux'}))
|
||||
def test_audio_runtime_package_definition_matches_exact_repo_and_model(self):
|
||||
import json
|
||||
from profiles import audio_package_recipe
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
Path(d,'model_specs').mkdir();Path(d,'model_specs/test.json').write_text(json.dumps(dict(packages=[dict(target_directory='Example-GGUF',files=['model.gguf','config.json'])])))
|
||||
model=dict(repo='audio-cpp/Example-GGUF',file='model.gguf')
|
||||
self.assertEqual(audio_package_recipe(model,d)['runtime_file_0']['files'],['config.json'])
|
||||
self.assertIsNone(audio_package_recipe(dict(model,repo='other/Example-GGUF'),d))
|
||||
|
||||
Reference in New Issue
Block a user