test: Add tests for save_for_aiu functionality w/ tiny models#126
Conversation
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
…g, and changed qconfig_save warning to logger.info Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
…tting Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
| else: | ||
| self.register_buffer( | ||
| "clip_val", torch.zeros(perCh) if perCh else torch.Tensor([1.0]) | ||
| "clip_val", torch.zeros(perCh) if perCh else torch.Tensor([0.0]) |
There was a problem hiding this comment.
Uninitialized clip_vals are supposed to be zero tensors, but for some reason this one was set to 1.0. This is consistent for other quantizers currently.
| dataset, | ||
| batch_size=batch_size, | ||
| shuffle=False, | ||
| collate_fn=lambda batch: tuple(torch.stack(samples) for samples in zip(*batch)), |
There was a problem hiding this comment.
This collate_fn was needed to return a tuple(tensor, tensor) as stated in the comment above.
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
andrea-fasoli
left a comment
There was a problem hiding this comment.
these unit tests for save_for_aiu look good to me now!
| Returns: | ||
| dict: Model state dictionary | ||
| """ | ||
| return torch.load(fname, weights_only=True) |
There was a problem hiding this comment.
do we need a func for a one-liners?
| """ | ||
| Delete any known files lingering before starting test | ||
| """ | ||
| delete_file("qcfg.json") |
There was a problem hiding this comment.
seems like the purpose is to auto-apply this init-like func before every tests? maybe the we can rename it to something more generic, so we could do more than just delete files if needed?
| """ | ||
| Delete any known files lingering before starting test | ||
| """ | ||
| delete_file("qcfg.json") |
There was a problem hiding this comment.
same as above
|
|
||
|
|
||
| @pytest.fixture(autouse=True) | ||
| def delete_files(): |
Description of the change
Added a new tests/models named test_save_aiu.py. This includes implementing new "tiny" models for BERT, Llama, and Granite from custom configs that are trimmed down.
Also, several test files have been cleaned up with the new autouse=True fixture for file deletion before a test starts.
How to verify the PR
Change to tests/models and run
pytest test_save_aiu.pyWas the PR tested