fix: display all abliterable components across layers (#215)
* fix: display all abliterable components across layers The current code only displays abliterable components from layer 0, which is misleading for hybrid architectures like Qwen3.5 that use different attention types across layers (e.g., `linear_attn.out_proj` in some layers, `self_attn.o_proj` in others). This fix iterates through all layers to collect and display the complete set of abliterable components with accurate module counts. Before (Qwen3.5-27B): * attn.out_proj: 1 modules per layer * mlp.down_proj: 1 modules per layer After (Qwen3.5-27B): * attn.out_proj: 48 modules total * attn.o_proj: 16 modules total * mlp.down_proj: 64 modules total * Fix formatting --------- Co-authored-by: Lawfer12 <ac728@ymail.com>
This commit is contained in:
@@ -151,10 +151,14 @@ class Model:
|
|||||||
|
|
||||||
print(f"* Transformer model with [bold]{len(self.get_layers())}[/] layers")
|
print(f"* Transformer model with [bold]{len(self.get_layers())}[/] layers")
|
||||||
print("* Abliterable components:")
|
print("* Abliterable components:")
|
||||||
for component, modules in self.get_layer_modules(0).items():
|
all_components = {}
|
||||||
print(
|
for layer_index in range(len(self.get_layers())):
|
||||||
f" * [bold]{component}[/]: [bold]{len(modules)}[/] modules per layer"
|
for component, modules in self.get_layer_modules(layer_index).items():
|
||||||
)
|
if component not in all_components:
|
||||||
|
all_components[component] = 0
|
||||||
|
all_components[component] += len(modules)
|
||||||
|
for component, count in all_components.items():
|
||||||
|
print(f" * [bold]{component}[/]: [bold]{count}[/] modules total")
|
||||||
|
|
||||||
def _apply_lora(self):
|
def _apply_lora(self):
|
||||||
# Guard against calling this method at the wrong time.
|
# Guard against calling this method at the wrong time.
|
||||||
|
|||||||
Reference in New Issue
Block a user