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.
This is the sparseGPT code based on IST-DASLab project.
I followed the same coding principles as used in the lit-llama gptq code.
I created a file called sparsification which is the algorithm for SparseGPT and a folder called sparsify/sparsegpt.py to run the algorithm on the model in the checkpoint_path.
This is my first contribution to the project, If I missed some household admin I apologize in advance.
Assuming you have a model under checkpoints/open-llama/7B
you can run this command:
python sparsify/sparsegpt.py --checkpoint_path checkpoints/lit-llama/7B/lit-llama.pth
Key Notes:
I used half n_samples (128-->64) due to memory requirement
The SparseGPT paper was evaluated on models trained not using the chinchilla scaling law (Therefore my hypothesis is that some of the weights of those models were not useful, hence they were able to prune 50%). With Llama I only used 0.1 target sparsity.)
The source code of SparseGPT consists of a quantization algorithm similar to GPTQ, however, I removed this code because we already have GPTQ in the lit-llama source code. If you would like me to include it, it is also okay I can include GPTQ under the sparseGPT code.
Before you commit, please also test from your side, and let me know if you want me to solve any bug or integrate a specific feature
Thanks