This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataset = TensorDataset(inputs, targets) | |
dataset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FishModel(nn.Module): | |
def __init__(self): | |
super().__init__() | |
self.linear = nn.Linear(input_size, output_size) # fill this (hint: use input_size & output_size defined above) | |
def forward(self, xb): | |
out = self.linear(xb) # fill this | |
return out | |
def training_step(self, batch): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model = FishModel() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def evaluate(model, val_loader): | |
outputs = [model.validation_step(batch) for batch in val_loader] | |
return model.validation_epoch_end(outputs) | |
def fit(epochs, lr, model, train_loader, val_loader, opt_func=torch.optim.SGD): | |
history = [] | |
optimizer = opt_func(model.parameters(), lr) | |
for epoch in range(epochs): | |
# Training Phase | |
for batch in train_loader: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model = FishModel() | |
epochs = 1000 | |
lr = 1e-2 | |
history1 = fit(epochs, lr, model, train_loader, val_loader) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def predict_single(input, target, model): | |
inputs = input.unsqueeze(0) | |
predictions = model(inputs) # fill this #model(inputs) | |
prediction = predictions[0].detach() | |
print("Input:", input) | |
print("Target:", target) | |
print("Prediction:", prediction) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input, target = val_ds[10] | |
predict_single(input, target, model) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%------------------------- | |
% Resume in Latex | |
% Author : Sourabh Bajaj | |
% License : MIT | |
%------------------------ | |
\documentclass[letterpaper,11pt]{article} | |
\usepackage{latexsym} | |
\usepackage[empty]{fullpage} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stages: | |
- test | |
publish: | |
image: docker:20.10.12-git | |
stage: test | |
services: | |
- docker:20.10.12-dind | |
tags: | |
- docker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gitlabUrl: <your gitlab URL> | |
runnerRegistrationToken: <your runner secret> | |
rbac: | |
create: True | |
clusterWideAccess: true | |
# runners: | |
# image: ubuntu:18.04 | |
# privileged: true | |
runners: | |
privileged: true |