Skip to content

Instantly share code, notes, and snippets.

View DicksonWu654's full-sized avatar
🦁

Dickson Wu DicksonWu654

🦁
View GitHub Profile
query MyQuery {
users(where: {borrowedReservesCount_gte: 5}, first: 1000) {
borrowHistory {
borrowRate
borrowRateMode
amount
id
timestamp
}
liquidationCallHistory(where: {}) {
def train(model, iterator, optimizer, loss_func):
#Initializing them
epoch_loss = 0
epoch_accuracy = 0
#Gets the model in training mode
model.train()
for batch in iterator:
#Set the gradietns to 0
TEXT = Field(tokenize=tok,batch_first=True,include_lengths=True)
LABEL = Field(sequential=False, use_vocab=True)
train_iter = BucketIterator(train_thing, batch_size=bs, sort_key=lambda x: len(x.sequence),
device=device, sort=True, sort_within_batch=True)
valid_iter = BucketIterator(valid_thing, batch_size=bs, sort_key=lambda x: len(x.sequence),
device=device, sort=True, sort_within_batch=True)