Skip to content

Instantly share code, notes, and snippets.

View Flock1's full-sized avatar

Flock-Anizak Flock1

View GitHub Profile
User belongs to experiment group 'pythonaa'
User belongs to experiment group 'pythonJediLSP'
User belongs to experiment group 'pythonSendEntireLineToREPL'
User belongs to experiment group 'pythonNotDisplayLinterPrompt'
User belongs to experiment group 'pythonDiscoveryModule'
User belongs to experiment group 'pythonTensorboardExperiment'
User belongs to experiment group 'PythonPyTorchProfiler'
User belongs to experiment group 'ShowExtensionSurveyPrompt - control'
User belongs to experiment group 'CollectLSRequestTiming - control'
Info 2021-04-13 00:49:04: Display locator refreshing progress, Class name = g, completed in 1ms, has a falsy return value, , Return Value: undefined
class UpSample(nn.Module):
def __init__(self,feat_in,feat_out,out_shape=None,scale=2):
super().__init__()
self.conv = nn.Conv2d(feat_in,feat_out,kernel_size=(3,3),stride=1,padding=1)
self.out_shape,self.scale = out_shape,scale
def forward(self,x):
return self.conv(
nn.functional.interpolate(
@Flock1
Flock1 / model.py
Last active September 3, 2020 17:21
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchaudio
from torch.autograd import Variable
Collecting git+https://github.com/facebookresearch/pytorch3d.git
Cloning https://github.com/facebookresearch/pytorch3d.git to /tmp/pip-req-build-yyykcly2
Running command git clone -q https://github.com/facebookresearch/pytorch3d.git /tmp/pip-req-build-yyykcly2
Requirement already satisfied: torchvision>=0.4 in ./anaconda3/envs/work/lib/python3.8/site-packages (from pytorch3d==0.2.0) (0.6.0a0+82fd1c8)
Processing ./.cache/pip/wheels/a6/c2/56/ce21635637947b871a9b39e6cb33e3f11ec6e65acb8f901ccb/fvcore-0.1.1.post20200716-py3-none-any.whl
Requirement already satisfied: numpy in ./anaconda3/envs/work/lib/python3.8/site-packages (from torchvision>=0.4->pytorch3d==0.2.0) (1.19.1)
Requirement already satisfied: torch in ./anaconda3/envs/work/lib/python3.8/site-packages (from torchvision>=0.4->pytorch3d==0.2.0) (1.5.0)
Requirement already satisfied: pillow>=4.1.1 in ./anaconda3/envs/work/lib/python3.8/site-packages (from torchvision>=0.4->pytorch3d==0.2.0) (7.2.0)
Collecting tqdm
Using cached tqdm-4.48.2-py2.py3-no
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import backend as K
from tensorflow.keras.models import load_model, Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.utils import Sequence
class ActorCritic(nn.Module):
def __init__(self, num_inputs, num_outputs, hidden_size, std=0.0):
super(ActorCritic, self).__init__()
self.critic = nn.Sequential(
nn.Linear(num_inputs, hidden_size),
nn.ReLU(),
nn.Linear(hidden_size, 1)
)
from torch.utils.data import Dataset, DataLoader
import pandas as pd
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from sklearn.model_selection import train_test_split
# from fastai.vision.models import resnet34
# from fastai.vision.leaner import unet_learner
from fastai.vision import *
p1_0: [0.5404173787448456, 0.41291281118626466, 1.0, 0.0]
p2_0: [0.4595826212551544, 0.5870871888137354, 0.0, 1.0]
idx_0: ['3FLip X', '5FLip X', '7FLip X', '9FLip X']
p1_1: [0.4595826212551544]
p2_1: [0.5404173787448456]
idx_1: ['4Flip Y']
p1_2: []
p2_2: []
idx_2: []
p1_3: [0.03264615290754886, 0.4595826212551544]
@Flock1
Flock1 / training.py
Last active December 18, 2019 09:30
def act(self, data,t): #state
rate = self.get_exploration_rate(t)
if random.random() < rate:
options = self.model.predict(data) #state
options = np.squeeze(options)
action = random.randrange(self.action_size)
else:
options = self.model.predict(data) #state
options = np.squeeze(options)
action = options.argmax()
Created temporary directory: /tmp/pip-ephem-wheel-cache-h28bm0z4
Created temporary directory: /tmp/pip-req-tracker-a9vehy36
Created requirements tracker '/tmp/pip-req-tracker-a9vehy36'
Created temporary directory: /tmp/pip-install-lla89gd9
Processing /home/sarvagya/Desktop/RBC/box-convolutions
Created temporary directory: /tmp/pip-req-build-k9raxzlj
Added file:///home/sarvagya/Desktop/RBC/box-convolutions to build tracker '/tmp/pip-req-tracker-a9vehy36'
Running setup.py (path:/tmp/pip-req-build-k9raxzlj/setup.py) egg_info for package from file:///home/sarvagya/Desktop/RBC/box-convolutions
Running command python setup.py egg_info
running egg_info