Download tests/test_decoder_selection.py from EliovpAI/Qwen_Image-2.1-Uncensored-MXFP4-Paiton: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/EliovpAI/Qwen_Image-2.1-Uncensored-MXFP4-Paiton/resolve/main/tests/test_decoder_selection.py
- Command line
-
hf download hf://EliovpAI/Qwen_Image-2.1-Uncensored-MXFP4-Paiton/tests/test_decoder_selection.py
-
curl -L -o test_decoder_selection.py https://huggingface.co/EliovpAI/Qwen_Image-2.1-Uncensored-MXFP4-Paiton/resolve/main/tests/test_decoder_selection.py
1.54 kB
| """Architecture routing and artifact-integrity checks; no framework or GPU.""" | |
| import hashlib | |
| import json | |
| from pathlib import Path | |
| import tempfile | |
| import unittest | |
| from qwen_image21.decoder import select_decoder | |
| class DecoderSelection(unittest.TestCase): | |
| def fixture(self,root): | |
| data=b'allowlisted library bytes';(root/'decoder.so').write_bytes(data) | |
| (root/'manifest.json').write_text(json.dumps(dict(file='decoder.so',architecture='gfx1201',abi_version=1,sha256=hashlib.sha256(data).hexdigest()))) | |
| def test_mi355_auto_does_not_need_or_load_rdna4_artifact(self): | |
| path,reason=select_decoder('gfx950:sramecc+:xnack-','auto','/does/not/exist') | |
| self.assertIsNone(path);self.assertIn('gfx950',reason) | |
| def test_explicit_native_rejects_other_architecture(self): | |
| with self.assertRaisesRegex(ValueError,'gfx1201 only'): | |
| select_decoder('gfx950','native','/does/not/exist') | |
| def test_rdna4_auto_verifies_artifact_and_detects_corruption(self): | |
| with tempfile.TemporaryDirectory() as tmp: | |
| root=Path(tmp);self.fixture(root) | |
| path,_=select_decoder('gfx1201','auto',root);self.assertEqual(path,root/'decoder.so') | |
| (root/'decoder.so').write_bytes(b'corrupt') | |
| with self.assertRaisesRegex(ValueError,'SHA-256 mismatch'): | |
| select_decoder('gfx1201','auto',root) | |
| def test_framework_override_does_not_require_native_library(self): | |
| self.assertIsNone(select_decoder('gfx1201','framework','/does/not/exist')[0]) | |