mirror of
https://github.com/AntoineHX/smart_augmentation.git
synced 2025-05-04 04:00:46 +02:00
Sauvegarde both mesure memoire
This commit is contained in:
parent
7d5aa7c6fb
commit
65e67addf6
2 changed files with 14 additions and 8 deletions
|
@ -82,7 +82,7 @@ if __name__ == "__main__":
|
|||
}
|
||||
#Parameters
|
||||
n_inner_iter = 1
|
||||
epochs = 150
|
||||
epochs = 2
|
||||
dataug_epoch_start=0
|
||||
optim_param={
|
||||
'Meta':{
|
||||
|
@ -147,6 +147,7 @@ if __name__ == "__main__":
|
|||
#### Augmented Model ####
|
||||
if 'aug_model' in tasks:
|
||||
torch.cuda.reset_max_memory_allocated() #reset_peak_stats
|
||||
torch.cuda.reset_max_memory_cached() #reset_peak_stats
|
||||
t0 = time.perf_counter()
|
||||
|
||||
tf_dict = {k: TF.TF_dict[k] for k in tf_names}
|
||||
|
@ -163,10 +164,11 @@ if __name__ == "__main__":
|
|||
print_freq=1,
|
||||
unsup_loss=1,
|
||||
hp_opt=False,
|
||||
save_sample_freq=1)
|
||||
save_sample_freq=None)
|
||||
|
||||
exec_time=time.perf_counter() - t0
|
||||
max_cached = torch.cuda.max_memory_allocated()/(1024.0 * 1024.0) #torch.cuda.max_memory_reserved() #MB
|
||||
max_allocated = torch.cuda.max_memory_allocated()/(1024.0 * 1024.0)
|
||||
max_cached = torch.cuda.max_memory_cached()/(1024.0 * 1024.0) #torch.cuda.max_memory_reserved() #MB
|
||||
####
|
||||
print('-'*9)
|
||||
times = [x["time"] for x in log]
|
||||
|
@ -174,7 +176,7 @@ if __name__ == "__main__":
|
|||
"Time": (np.mean(times),np.std(times), exec_time),
|
||||
'Optimizer': optim_param,
|
||||
"Device": device_name,
|
||||
"Memory": max_cached,
|
||||
"Memory": [max_allocated, max_cached],
|
||||
"Param_names": aug_model.TF_names(),
|
||||
"Log": log}
|
||||
print(str(aug_model),": acc", out["Accuracy"], "in:", out["Time"][0], "+/-", out["Time"][1])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue