Comments (9)
I have the same question and I just use the code "
model = AutoModelForCausalLM.from_pretrained('llama2')
c_loss, m_loss = model(examples, labels, observations)",and it all make mistake in library function
只有“c_loss, m_loss = model(examples, labels, observations)”是自己写的代码报错,其他都是库函数报错
from sparsegpt.
same
from sparsegpt.
wondering if this is a transformers version issue
from sparsegpt.
outs[j] = layer(inps[j].unsqueeze(0), attention_mask=attention_mask)[0]
这一行代码没有加位置编码。更改之后是这样的
outs[j] = layer(inps[j].unsqueeze(0), attention_mask=attention_mask, position_ids=cache_position)[0]
@phind-justin @thistleknot
from sparsegpt.
wondering if this is a transformers version issue
hi you can refer the code fo wanda: https://github.com/locuslab/wanda/blob/main/lib/prune.py,modify function of llama.py as prune_sparsegpt()
from sparsegpt.
hi you can refer the code fo wanda: https://github.com/locuslab/wanda/blob/main/lib/prune.py,modify function of llama.py as prune_sparsegpt()
hi you can refer the code fo wanda: https://github.com/locuslab/wanda/blob/main/lib/prune.py , modify function of llama.py as prune_sparsegpt()
from sparsegpt.
I get this same error trying locally.
(venv)$ python llama.py /data/Llama3-ChatQA-1.5-8B c4 --sparsity 0.5
...
File "sparsegpt/venv/lib/python3.11/site-packages/transformers/models/llama/modeling_llama.py", line 110, in forward
inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1)
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'shape'
from sparsegpt.
@algorithmexplorer cache_position是啥
from sparsegpt.
Hi! If you are running squeeze LLM and have the same issue, this may be useful.
The issue can be attributed to the null position_ids.
First, at llama.py, check class "class Catcher(nn.Module):", in the original code, it is like this:
And position ids are obtained by:
But after I read the code of GPTQ for llama, which runs well with llama. It is written like this:
And
After changing them, I finnaly obtain the position_ids, which is a 2048 size torch.tensor. Please also make ture that the "try" command runs well, because this will affect the size of position_ids (not run will come up with size does not match error(4096 vs. 2048)).
Did not know the real reason, but works for me.
from sparsegpt.
Related Issues (20)
- How should I verify the speedup effect of the algorithm? HOT 4
- Purpose of this update
- finetuning sparsified LLaMa HOT 5
- Inference Speedup HOT 3
- Dependencies are wrong HOT 3
- Would sparsegpt be available for Llama2? HOT 3
- When would the code for GPT-J-6B be released?
- Adaptation for Pruning Conv2d or Conv3d Layers? HOT 1
- Can SparseGPT be used on BERT ?
- Using llama.py silently fails and occasionally causes system instability
- transformers version is not correct
- Mistral Support HOT 2
- how to use for Baichuan?
- 2:4 sparsity with to_sparse_semi_structured method from pytorch results in memory issue
- Why Hessian can get by activation ($H = XX^T$) ? HOT 4
- Why transpose the input when in case of nn.Linear or nn.Conv1d?
- AWQ alongside sparsegpt
- why i can't reproduce the result of paper? HOT 7
- [feature request] all models.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sparsegpt.