Download LLM-Drop_superweights/src/llmtuner/compression/quantization/AutoGPTQ/modelutils.py from s1ghhh/nbl_try: direct link, hf CLI and curl.
- Browser
- Download file 397 Bytes
-
https://huggingface.co/s1ghhh/nbl_try/resolve/main/LLM-Drop_superweights/src/llmtuner/compression/quantization/AutoGPTQ/modelutils.py
- Command line
-
hf download hf://s1ghhh/nbl_try/LLM-Drop_superweights/src/llmtuner/compression/quantization/AutoGPTQ/modelutils.py
-
curl -L -o modelutils.py https://huggingface.co/s1ghhh/nbl_try/resolve/main/LLM-Drop_superweights/src/llmtuner/compression/quantization/AutoGPTQ/modelutils.py
397 Bytes
| import torch | |
| import torch.nn as nn | |
| DEV = torch.device('cuda:0') | |
| def find_layers(module, layers=[nn.Conv2d, nn.Linear], name=''): | |
| if type(module) in layers: | |
| return {name: module} | |
| res = {} | |
| for name1, child in module.named_children(): | |
| res.update(find_layers( | |
| child, layers=layers, name=name + '.' + name1 if name != '' else name1 | |
| )) | |
| return res | |