<jupyter_start><jupyter_text>DAM<jupyter_code>from fastai.vision.all import *
import pandas as pd
import cam
import util
base_model_name = 'xse_resnext50-chexpert-final'

dls, labels = util.chexpert_data_loader(bs=8)
# Load the base model
model_base = cnn_learner(dls, densenet121, n_out=len(labels), path=Path('../saves/'), y_range=(0,1))
model_base.load(base_model_name)

# Set all parameters to require grad
for param in model_base.parameters():
    param.requires_grad = True
    
# Initialize DAM learner
dam_learner = util.DAM(model_base, dls, folder=Path('../saves/xse_resnext50-chexpert-dam'), lr=0.08)
print(f'Initial AUC score: {dam_learner.eval()}')
dam_learner.train(max_epoch=4, lr_div=1.2)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13096862210095497, 'fraction_numerical': 0.021828103683492497, 'mean_word_length': 6.645833333333333, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '181395', 'license': 'Apache-2.0', 'n_tokens_mistral': 295, 'n_tokens_neox': 286, 'n_words': 53, 'path': 'models/Squeeze_and_Excite_ResNet_w_dam.ipynb', 'repo_name': 'pujandave25/chexpert', 'size': '733'}