-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CORE] [FEATURE] Add verify_hash (#50)
* add verify_hash for quantized model * use is_sharded choose verify * mod clean up * move to utils * remove unuse import * mod clean up * mod clean up * Add usage doc * mod name and type check * mod support hashlib types * add unit test * Update auto.py * clean up verify test code * format code --------- Co-authored-by: Qubitium-ModelCloud <[email protected]>
- Loading branch information
1 parent
b8003ee
commit 9a485ba
Showing
6 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import unittest | ||
|
||
from gptqmodel import GPTQModel | ||
|
||
|
||
class TestVerifyHashFunction(unittest.TestCase): | ||
MODEL_ID = "LnL-AI/TinyLlama-1.1B-Chat-v1.0-GPTQ-4bit" | ||
EXPECTED_MD5_HASH = "md5:7725c72bc217bcb57b3f1f31d452d871" | ||
EXPECTED_SHA256_HASH = "sha256:2680bb4d5c977ee54f25dae584665641ea887e7bd8e8d7197ce8ffd310e93f2f" | ||
|
||
|
||
def test_verify_md5_hash_function(self): | ||
# Load the model with MD5 verify_hash parameter | ||
model = GPTQModel.from_quantized(self.MODEL_ID, device="cuda:0", use_marlin=True, | ||
verify_hash=self.EXPECTED_MD5_HASH) | ||
self.assertIsNotNone(model) | ||
|
||
def test_verify_sha256_hash_function(self): | ||
# Load the model with SHA-256 verify_hash parameter | ||
model = GPTQModel.from_quantized(self.MODEL_ID, device="cuda:0", use_marlin=True, | ||
verify_hash=self.EXPECTED_SHA256_HASH) | ||
# Add additional checks to ensure the model is loaded correctly | ||
self.assertIsNotNone(model) | ||
|