facebookresearch / SLIP
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 220 units with 2,874 lines of code in units (88.0% of code).
    • 1 very complex units (314 lines of code)
    • 3 complex units (338 lines of code)
    • 5 medium complex units (213 lines of code)
    • 14 simple units (433 lines of code)
    • 197 very simple units (1,576 lines of code)
10% | 11% | 7% | 15% | 54%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
py10% | 11% | 7% | 15% | 54%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
beit_finetuning25% | 6% | 10% | 7% | 51%
ROOT0% | 16% | 5% | 21% | 57%
redcaps0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main()
in beit_finetuning/run_class_finetuning.py
314 81 2
def create_optimizer()
in beit_finetuning/optim_factory.py
76 37 6
def main()
in main.py
132 32 1
def main()
in main_linear.py
130 28 1
def auto_load_model()
in beit_finetuning/utils.py
47 20 6
def train()
in main.py
54 16 8
def load_state_dict()
in beit_finetuning/utils.py
41 13 4
31 12 4
def __init__()
in beit_finetuning/modeling_finetune.py
40 11 21
def bpe()
in tokenizer.py
37 10 2
def validate_zeroshot()
in eval_zeroshot.py
40 10 6
def get_parameter_groups()
in beit_finetuning/optim_factory.py
36 9 3
def __init__()
in datasets.py
19 9 4
def main()
in eval_zeroshot.py
62 9 1
def get_grad_norm_()
in beit_finetuning/utils.py
13 8 2
14 8 2
def log_every()
in beit_finetuning/utils.py
45 7 4
def train()
in main_linear.py
32 7 6
def get_raw_item()
in datasets.py
27 6 2
def validate()
in main_linear.py
30 6 4