MCPcopy Create free account
hub / github.com/OpenBMB/ToolBench / get_compressed_list

Function get_compressed_list

toolbench/model/compression.py:49–58  ·  view source on GitHub ↗
(module, prefix="")

Source from the content-addressed store, hash-verified

47
48
49def get_compressed_list(module, prefix=""):
50 compressed_list = []
51 for name, child in module.named_children():
52 if isinstance(child, nn.Linear):
53 full_name = f"{prefix}.{name}.weight" if prefix else f"{name}.weight"
54 compressed_list.append(full_name)
55 compressed_list.extend(
56 get_compressed_list(child, full_name)
57 )
58 return compressed_list
59
60
61def apply_compressed_weight(module, compressed_state_dict, target_device, prefix=""):

Callers 1

load_compress_modelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected