Function train
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def train(
config_file: str,
train_file: str,
val_file: str,
output_dir: str,
Function train
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def train(
config_file: str,
train_file: str,
val_file: str,
output_dir: str,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function train
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def train(
Function _save_checkpoint
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _save_checkpoint(self, model, trial, metrics=None):
print("Running custom _save_checkpoint")
checkpoint_folder = f"{PREFIX_CHECKPOINT_DIR}-{self.state.global_step}"
run_dir = self._get_output_dir(trial=trial)
output_dir = os.path.join(run_dir, checkpoint_folder)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function custom_prepare_model_for_int8_training
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def custom_prepare_model_for_int8_training(
model,
output_embedding_layer_name="lm_head",
layer_norm_names=["layer_norm"]
):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"