slp-ntua / slp-labs

Lab code and instructions for the Speech and language Processing course in the National Technical University of Athens
MIT License
6 stars 6 forks source link

Helper code for NLP Lab #130

Open pxaris opened 2 months ago

pxaris commented 2 months ago

Issue που θα χρησιμοποιηθεί κατά τη διάρκεια του Εργαστηρίου NLP (στις 26/4/24) για τη σημείωση βοηθητικού κώδικα, οδηγιών κ.α.

pxaris commented 2 months ago

Pre-lab - 8

criterion = torch.nn.BCEWithLogitsLoss() if n_classes == 2 else torch.nn.CrossEntropyLoss() 
parameters = [param for param in model.parameters() if param.requires_grad]
optimizer = torch.optim.Adam(parameters, lr=0.001)