Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds quantization experiment scripts (Moment + LPTM) intended to generate VLDB table results, and updates the core library to support quantization workflows.
Changes:
- Add two example scripts to measure MSE / model size / inference time across FP32/FP16/INT8 (with optional CUDA bitsandbytes INT8).
- Add
bitsandbytesto project dependencies. - Modify
src/samay/model.pyquantization helper and reformat several method signatures/lines.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/samay/model.py |
Introduces a local quantize_linear_layers() and uses it from model quantize() methods; also contains formatting-only changes. |
src/samay/dataset.py |
Removes an assignment to self.freq in BaseDataset.__init__. |
pyproject.toml |
Adds bitsandbytes to dependencies. |
example/moment_quantize_table_results.py |
New script to run Moment quantization experiments (FP32/FP16/INT8). |
example/lptm_quantize_table_results.py |
New script to run LPTM quantization experiments (FP32/FP16/INT8). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
1317
to
+1323
| def quantize(self, quant_type="int8", device="cuda"): | ||
| self.model.eval() | ||
| self.model = self.model.to(device) | ||
| with torch.no_grad(): | ||
| self.model = quantize_linear_layers(self.model, quantization_type=quant_type) | ||
| self.model = quantize_linear_layers( | ||
| self.model, quantization_type=quant_type | ||
| ) |
Comment on lines
1781
to
+1787
| def quantize(self, quant_type="int8", device="cuda"): | ||
| self.model.eval() | ||
| self.model = self.model.to(device) | ||
| with torch.no_grad(): | ||
| self.model = quantize_linear_layers(self.model, quantization_type=quant_type) | ||
| self.model = quantize_linear_layers( | ||
| self.model, quantization_type=quant_type | ||
| ) |
| "torchvision>=0.20.1", | ||
| "lightning>=2.5.1", | ||
| "plotly>=6.3.0", | ||
| "bitsandbytes>=0.49.2", |
Comment on lines
+145
to
+152
| val_dataset = MomentDataset( | ||
| name="ett", | ||
| datetime_col="date", | ||
| path="./src/samay/models/moment/data/ETTh1.csv", | ||
| mode="test", | ||
| horizon_len=192, | ||
| freq=None, | ||
| ) |
Comment on lines
+153
to
+159
| train_dataset = LPTMDataset( | ||
| name="ett", | ||
| datetime_col="date", | ||
| path="./data/data/ETTh1.csv", | ||
| mode="train", | ||
| horizon=192, | ||
| ) |
Comment on lines
+161
to
+167
| val_dataset = LPTMDataset( | ||
| name="ett", | ||
| datetime_col="date", | ||
| path="./data/data/ETTh1.csv", | ||
| mode="test", | ||
| horizon=192, | ||
| ) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Quantization files (for Moment and LPTM) to create tables for VLDB paper. Should be run with GPU.
CPU results:
LPTM Results (ETTh1, Horizon=192)
Float32 | MSE: 1.04811 | Size: 491.96 MB | Speedup: 1.0x
Float16 | MSE: 1.04811 | Size: 246.00 MB | Speedup: 0.28x
INT8 | MSE: 1.04816 | Size: 209.10 MB | Speedup: 0.44x
MOMENT Results (ETTh1, Horizon=192)
Float32 | MSE: 0.11024 | Size: 1435.86 MB | Speedup: 1.0x
Float16 | MSE: 0.11024 | Size: 717.97 MB | Speedup: 0.17x
INT8 | MSE: 0.11024 | Size: 474.45 MB | Speedup: 0.41x