<jupyter_start><jupyter_text>Knowledge dilstillation<jupyter_code>config.batch_size = 32
config.max_epoch = 3
classes_list = [30, 105, 300, 340, 386, 526, 527, 673, 779, 985]
merge_list1 = [30, 105]
merge_list2 = [30, 105, 300, 340]
merge_list3 = [30, 105, 300, 340, 386, 526]
merge_list4 = [30, 105, 300, 340, 386, 526, 527, 673]
merge_list5 = [30, 105, 300, 340, 386, 526, 527, 673, 779, 985]

t_agent = globals()["AssembleNetResNet"](config)
t_agent.init_graph(pretrained=True)
t_agent.set_subtask(*merge_list1)
best, history = t_agent.train(specializing=True, freeze_conv=False)

config.max_epoch = 10
agent = globals()["AssembleNetResNet"](config)
agent.init_graph(pretrained=False)
agent.set_subtask(*merge_list1)
agent.compress(method='first_k', k=0.5)
history = agent.distill(t_agent, alpha=0.5, T=1)

print(agent.best_valid_acc)
print(count_model_param_nums(agent.model) / 1e6)
print(count_model_flops(agent.model, input_res=224).item() / 1e9)
classes_list = [30, 105, 300, 340, 386, 526, 527, 673, 779, 985]
merge_list1 = [30, 105]
merge_list2 = [30, 105, 300, 340]
merge_list3 = [30, 105, 300, 340, 386, 526]
merge_list4 = [30, 105, 300, 340, 386, 526, 527, 673]
merge_list5 = [30, 105, 300, 340, 386, 526, 527, 673, 779, 985]
agent_list = []
config.max_epoch = 3
for i in merge_list2:
    temp_agent = globals()["AssembleNetResNet"](config)
    temp_agent.init_graph(pretrained=True)
    cls = i
    temp_agent.set_subtask(cls)
    temp_agent.compress(method='gradient', k=0.86)
    temp_agent.train(specializing=True, freeze_conv=False)
    agent_list.append(temp_agent)

config.max_epoch = 10
agent = globals()["AssembleNetResNet"](config)
agent.init_graph(pretrained=False)
agent.compress(method='first_k', k=0.5)
agent.distill(*agent_list, alpha=0.5, T=1)
best, history = agent.train(specializing=True, freeze_conv=False)

print(agent.best_valid_acc)
print(count_model_param_nums(agent.model) / 1e6)
print(count_model_flops(agent.model, input_res=224).item() / 1e9)
classes_list = [30, 105, 300, 340, 386, 526, 527, 673, 779, 985]
merge_list1 = [30, 105]
merge_list2 = [30, 105, 300, 340]
merge_list3 = [30, 105, 300, 340, 386, 526]
merge_list4 = [30, 105, 300, 340, 386, 526, 527, 673]
merge_list5 = [30, 105, 300, 340, 386, 526, 527, 673, 779, 985]
agent_list = []
config.max_epoch = 3
for i in merge_list3:
    temp_agent = globals()["AssembleNetResNet"](config)
    temp_agent.init_graph(pretrained=True)
    cls = i
    temp_agent.set_subtask(cls)
    temp_agent.compress(method='gradient', k=0.86)
    temp_agent.train(specializing=True, freeze_conv=False)
    agent_list.append(temp_agent)

config.max_epoch = 10
agent = globals()["AssembleNetResNet"](config)
agent.init_graph(pretrained=False)
agent.compress(method='first_k', k=0.5)
agent.distill(*agent_list, alpha=0.5, T=1)
best, history = agent.train(specializing=True, freeze_conv=False)

print(agent.best_valid_acc)
print(count_model_param_nums(agent.model) / 1e6)
print(count_model_flops(agent.model, input_res=224).item() / 1e9)
classes_list = [30, 105, 300, 340, 386, 526, 527, 673, 779, 985]
merge_list1 = [30, 105]
merge_list2 = [30, 105, 300, 340]
merge_list3 = [30, 105, 300, 340, 386, 526]
merge_list4 = [30, 105, 300, 340, 386, 526, 527, 673]
merge_list5 = [30, 105, 300, 340, 386, 526, 527, 673, 779, 985]
agent_list = []
config.max_epoch = 3
for i in merge_list4:
    temp_agent = globals()["AssembleNetResNet"](config)
    temp_agent.init_graph(pretrained=True)
    cls = i
    temp_agent.set_subtask(cls)
    temp_agent.compress(method='gradient', k=0.86)
    temp_agent.train(specializing=True, freeze_conv=False)
    agent_list.append(temp_agent)

config.max_epoch = 10
agent = globals()["AssembleNetResNet"](config)
agent.init_graph(pretrained=False)
agent.compress(method='first_k', k=0.5)
agent.distill(*agent_list, alpha=0.5, T=1)
best, history = agent.train(specializing=True, freeze_conv=False)

print(agent.best_valid_acc)
print(count_model_param_nums(agent.model) / 1e6)
print(count_model_flops(agent.model, input_res=224).item() / 1e9)
classes_list = [30, 105, 300, 340, 386, 526, 527, 673, 779, 985]
merge_list1 = [30, 105]
merge_list2 = [30, 105, 300, 340]
merge_list3 = [30, 105, 300, 340, 386, 526]
merge_list4 = [30, 105, 300, 340, 386, 526, 527, 673]
merge_list5 = [30, 105, 300, 340, 386, 526, 527, 673, 779, 985]
agent_list = []
config.max_epoch = 3
for i in merge_list5:
    temp_agent = globals()["AssembleNetResNet"](config)
    temp_agent.init_graph(pretrained=True)
    cls = i
    temp_agent.set_subtask(cls)
    temp_agent.compress(method='gradient', k=0.86)
    temp_agent.train(specializing=True, freeze_conv=False)
    agent_list.append(temp_agent)

config.max_epoch = 10
agent = globals()["AssembleNetResNet"](config)
agent.init_graph(pretrained=False)
agent.compress(method='first_k', k=0.5)
agent.distill(*agent_list, alpha=0.5, T=1)
best, history = agent.train(specializing=True, freeze_conv=False)

print(agent.best_valid_acc)
print(count_model_param_nums(agent.model) / 1e6)
print(count_model_flops(agent.model, input_res=224).item() / 1e9)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14986269125147117, 'fraction_numerical': 0.1353471949784229, 'mean_word_length': 6.151472650771389, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '514487', 'license': 'MIT', 'n_tokens_mistral': 2579, 'n_tokens_neox': 2035, 'n_words': 413, 'path': '.ipynb_checkpoints/query_2-checkpoint.ipynb', 'repo_name': 'bigdata-inha/Rethinking_network_pruning', 'size': '5098'}