Recognize model family hints and reusable runtimes
This commit is contained in:
+6
-1
@@ -4,9 +4,14 @@ import tempfile
|
||||
import time
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
from catalog import Catalog, safe_url, repo_id, is_derived_model
|
||||
from catalog import Catalog, safe_url, repo_id, is_derived_model, runtime_metadata
|
||||
|
||||
class CatalogTests(unittest.TestCase):
|
||||
def test_bounded_hub_runtime_metadata(self):
|
||||
hint=runtime_metadata(dict(pipeline_tag='text-to-image',library_name='diffusers',config={'architectures':['NewImagePipeline']},tags=['image-to-image']))
|
||||
self.assertEqual(hint['architecture'],'NewImagePipeline')
|
||||
self.assertEqual(hint['library_name'],'diffusers')
|
||||
self.assertEqual(runtime_metadata(dict(config={'architectures':['x'*200]}))['architecture'],None)
|
||||
def test_reject_untrusted_urls_and_repos(self):
|
||||
for value in ['http://huggingface.co/a','https://127.0.0.1/x','https://huggingface.co.evil.org/a','https://user@huggingface.co/a']:
|
||||
with self.assertRaises(ValueError):safe_url(value)
|
||||
|
||||
Reference in New Issue
Block a user