draw loss curve and save weights