in utils.py [0:0]
def print_train_params(config, setting, method, norm, save_dir):
params = config["parameters"]
model = params["model_config"]["model_class"]
dataset = params["dataset"]
model_name_map = {
"cpreresnet20": "cPreResNet20",
"resnet18": "ResNet18",
"vgg19": "VGG19",
}
method_name_map = {
"lcs_l": "LCS+L",
"lcs_p": "LCS+P",
"ns": "NS",
"us": "US",
"lec": "LEC",
"target_topk": "TopK Target",
"target_bit_width": "Bit Width Target",
}
dataset_name_map = {"cifar10": "CIFAR-10", "imagenet": "ImageNet"}
setting_name_map = {
"unstructured_sparsity": "Unstructured sparsity",
"structured_sparsity": "Structured sparsity",
"quantized": "Quantized",
}
msg = f"{setting_name_map[setting]} ({method_name_map[method]}) training:"
msg += f" {model_name_map[model]} on {dataset_name_map[dataset]} w/ {norm}."
if method == "target_topk":
topk_target = params["topk"]
msg += f" TopK target: {topk_target}."
elif method == "target_bit_width":
bit_width_target = params["num_bits"]
msg += f" Bit width target: {bit_width_target}."
print()
print(msg)
print(f"Saving to {save_dir}.")
print()
time.sleep(5)