Skip to content

Instantly share code, notes, and snippets.

Avatar
🐍
Python

Vaibhav Kumar Chaudhary vaibhavkumar049

🐍
Python
View GitHub Profile
View .vimrc
" plugins
let need_to_install_plugins = 0
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
let need_to_install_plugins = 1
endif
call plug#begin()
Plug 'tpope/vim-sensible'
@vaibhavkumar049
vaibhavkumar049 / a.py
Last active Jul 3, 2020
rekhta website screen shot
View a.py
import time
from selenium import webdriver
# Do not use this without their permission
# change website url
# chnage saving location in line 32
# change email/password
# change range in line 20 according to your book length
# start my code
from selenium.common.exceptions import NoSuchElementException
@vaibhavkumar049
vaibhavkumar049 / chunk_upload.py
Created Nov 22, 2019 — forked from nbari/chunk_upload.py
python chunk upload files
View chunk_upload.py
#!/usr/bin/env python
import os
import requests
import uuid
from random import randint
from uuid import uuid4
def read_in_chunks(file_object, chunk_size=65536):
while True:
@vaibhavkumar049
vaibhavkumar049 / README.md
Created Sep 16, 2019 — forked from CodingDoug/README.md
Copying data from Firebase Realtime Database to a Google Sheet in real time via Cloud Functions
View README.md
View modelmsad.py
class FirstNetwork_v3(nn.Module):
def __init__(self):
super().__init__()
torch.manual_seed(0)
self.net = nn.Sequential(
nn.Linear(2, 1024*4),
nn.Sigmoid(),
nn.Linear(1024*4, 4),
nn.Softmax()
View cudaaa.py
device = torch.device("cuda")
X_train=X_train.to(device)
Y_train=Y_train.to(device)
fn = FirstNetwork_v2()
fn.to(device)
tic = time.time()
print('Final loss', fit_v2(X_train, Y_train, fn, opt, loss_fn))
toc = time.time()
print('Time taken', toc - tic)
View f22.py
fn = FirstNetwork_v2()
loss_fn = F.cross_entropy
opt = optim.SGD(fn.parameters(), lr=1)
fit_v2(X_train, Y_train, fn, opt, loss_fn)
View fnn2.py
def fit_v2(x, y, model, opt, loss_fn, epochs = 1000):
for epoch in range(epochs):
loss = loss_fn(model(x), y)
loss.backward()
opt.step()
opt.zero_grad()
return loss.item()
View fnnnn.py
class FirstNetwork_v2(nn.Module):
def __init__(self):
super().__init__()
torch.manual_seed(0)
self.net = nn.Sequential(
nn.Linear(2, 2),
nn.Sigmoid(),
nn.Linear(2, 4),
nn.Softmax()