This file contains 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
import os | |
from datacrunch import DataCrunchClient | |
import time | |
import re | |
import toml | |
import argparse | |
import inquirer | |
# Load secrets and configurations | |
CONFIG_PATH = '/Users/[email protected]/configs/' |
This file contains 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
#%% LOAD MODEL OBJECTS | |
from transformers import AutoTokenizer, AutoModelForCausalLM | |
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B") | |
tokenizer.pad_token = tokenizer.eos_token | |
model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-j-6B", load_in_8bit=True) | |
from peft import LoraConfig, TaskType, get_peft_model, prepare_model_for_kbit_training | |
peft_config = LoraConfig(task_type=TaskType.CAUSAL_LM, inference_mode=False, r=4, lora_alpha=32, lora_dropout=0.1) | |
model = prepare_model_for_kbit_training(model) | |
model = get_peft_model(model, peft_config) |
This file contains 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
AC C | |
AN Polaris CTA | |
AL FL195 | |
AH FL660 | |
DP 70:00:00 N 015:00:00 E | |
DP 67:15:00 N 009:25:20 E | |
DP 66:12:39 N 007:42:28 E | |
DP 65:45:00 N 007:00:00 E | |
DP 65:37:05 N 006:50:25 E | |
DP 65:08:00 N 006:15:59 E |
This file contains 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
from torch.optim.optimizer import Optimizer | |
class OptimizerSGLD(Optimizer): | |
def __init__(self, net, alpha=1e-4, sgmcmc=True): | |
super(OptimizerSGLD, self).__init__(net.parameters(), {}) | |
self.net = net | |
self.sgmcmc = sgmcmc | |
self.alpha = alpha | |
self.noise_std = (2*self.alpha)**0.5 | |
@torch.no_grad() |
This file contains 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
#%% IMPORTS | |
import torch | |
import pytorch_lightning as pl | |
import matplotlib.pyplot as plt | |
from pytorch_lightning import Trainer | |
from torch.nn import functional as F | |
import pyro | |
import pyro.distributions as dist | |
# %% |
This file contains 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
#%% | |
import time | |
import numpy as np | |
import streamlit as st | |
import pandas as pd | |
import cv2 | |
video_sources = { | |
'Rindabotn' : "http://217.17.213.66:8081/mjpg/video.mjpg?overview=0&camera=1&videoframeskipmode=empty&Axis-Orig-Sw=true&resolution=1280x720", | |
'Hodlekve' : "http://217.17.213.66:8080/mjpg/video.mjpg?overview=0&camera=1&videoframeskipmode=empty&Axis-Orig-Sw=true&resolution=1280x720", |
This file contains 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
# coding: utf-8 | |
# In[3]: | |
import gym | |
import numpy as np | |
import tensorflow as tf | |
import keras |
This file contains 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
# This is a modification of **'s algorithm. (cant find it now) | |
# Some tuning was done: (cost is now negative, and added cost of ending the game with zero reward so the algorithm would want to go towards the goal) | |
# Also, training was done not monitored, as it seems like other people have done that. | |
# Managed to get just as good results with less steps, but the stochasticity of the problem makes it hard to reproduce. | |
import gym | |
import numpy as np | |