Skip to content

Commit

Permalink
just moving computer i actually have no idea what i'm committing lmao
Browse files Browse the repository at this point in the history
  • Loading branch information
enricobu96 committed Apr 20, 2024
1 parent f087727 commit 38b988f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions mACHINE-LEARNINGS/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ def eval(image):
- loss function: binary cross entropy loss
"""
model = DankCNN()
model.load_state_dict(torch.load('models/trained/model.pt'))
model.load_state_dict(torch.load('models/trained/model.pt', map_location=torch.device('cpu')))
model = model.to(device)

model.eval()
with torch.no_grad():
image = image.unsqueeze(0)
output = model(image.to(device))
prediction = output.data
print(prediction.item())
print('This meme is', cls[0 if prediction.item() < .5 else 1])


Expand Down
2 changes: 1 addition & 1 deletion mACHINE-LEARNINGS/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def execute(train_set_size, batch_size, lr, epochs, is_verbose, weight_decay):
model = DankCNN()
model = model.to(device)
# optimizer = torch.optim.RMSprop(model.parameters(), lr=.001, alpha=.99, eps=1e-08, weight_decay=0, momentum=0, centered=False)
optimizer = torch.optim.Adam(model.parameters(), lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0)
optimizer = torch.optim.Adam(model.parameters(), lr=0.0001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0)
# loss_function = torch.nn.HingeEmbeddingLoss()
loss_function = torch.nn.BCELoss()

Expand Down

0 comments on commit 38b988f

Please sign in to comment.