Skip to content

Instantly share code, notes, and snippets.

View MiniXC's full-sized avatar
🏠
Working from home

Christoph Minixhofer MiniXC

🏠
Working from home
  • Edinburgh
View GitHub Profile
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import logging
from lxml.html import parse
def yahoo_scrape(symbol_string):
"""
returns the string sector for a given symbol
"""
sector_string = ''
We can't make this file beautiful and searchable because it's too large.
Date,News
2016-07-01,"A 117-year-old woman in Mexico City finally received her birth certificate, and died a few hours later. Trinidad Alvarez Lira had waited years for proof that she had been born in 1898."
2016-07-01,IMF chief backs Athens as permanent Olympic host
2016-07-01,"The president of France says if Brexit won, so can Donald Trump"
2016-07-01,British Man Who Must Give Police 24 Hours' Notice of Sex Threatens Hunger Strike: The man is the subject of a sexual risk order despite having never been convicted of a crime.
2016-07-01,100+ Nobel laureates urge Greenpeace to stop opposing GMOs
2016-07-01,Brazil: Huge spike in number of police killings in Rio ahead of Olympics
2016-07-01,Austria's highest court annuls presidential election narrowly lost by right-wing candidate.
2016-07-01,"Facebook wins privacy case, can track any Belgian it wants: Doesn't matter if Internet users are logged into Facebook or not"
2016-07-01,"Switzerland denies Muslim girls citizenship after they refuse to swim with boys at sc
import torch
from torch import Tensor
from torch import nn
from torch.nn import functional as F
class FocalLoss(nn.Module):
""" see https://arxiv.org/abs/1708.02002
based on https://github.com/AdeelH/pytorch-multi-class-focal-loss/blob/master/focal_loss.py
"""
def __init__(self,
We can't make this file beautiful and searchable because it's too large.
,y_pred,y_pred_rounded,fips,date,y_true,week
0,0.03677709400653839,0,1001,2017-06-30,0.0,0
1,0.42399361729621887,0,1001,2017-12-27,1.0,0
2,0.017427001148462296,0,1001,2018-06-25,0.0,0
3,0.036498844623565674,0,1003,2017-06-30,0.0,0
4,0.7784255743026733,1,1003,2017-12-27,1.0382,0
5,0.3446190059185028,0,1003,2018-06-25,0.382,0
6,0.03354061394929886,0,1005,2017-06-30,0.0,0
7,0.744026780128479,1,1005,2017-12-27,1.0974,0
8,0.03732544928789139,0,1005,2018-06-25,0.0,0
We can't make this file beautiful and searchable because it's too large.
,y_pred,y_pred_rounded,fips,date,y_true,week
0,-0.043328024446964264,0,1001,2017-06-30,0.0,0
1,0.507280170917511,1,1001,2017-12-27,1.0,0
2,0.028431229293346405,0,1001,2018-06-25,0.0,0
3,-0.017092008143663406,0,1003,2017-06-30,0.0,0
4,0.6950212121009827,1,1003,2017-12-27,1.0382,0
5,0.31889382004737854,0,1003,2018-06-25,0.382,0
6,-0.0005514370277523994,0,1005,2017-06-30,0.0,0
7,0.820785403251648,1,1005,2017-12-27,1.0974,0
8,0.07871026545763016,0,1005,2018-06-25,0.0,0
@MiniXC
MiniXC / night_vale_ts.csv
Created January 8, 2022 17:49
Welcome to Night Vale Timestamps
number url episode_start weather_start weather_end episode_end
1 https://youtu.be/Ujksjzqrhys 37 740 911 1193
2 https://youtu.be/due3u22Licw 37 791 961 1150
3 https://youtu.be/jAPOTuVeBJc 39 866 1082 1188
4 https://youtu.be/KXDrp59tD0g 38 888 1162 1320
5 https://youtu.be/STw7cm3TSO8 34 863 1092 1200
6 https://youtu.be/Xmm6izeRcos 30 1017 1200 1307
7 https://youtu.be/4ZiJ0_CAw6k 35 942 1207 1402
8 https://youtu.be/hpC7qMZogDY 35 1009 1252 1375
9 https://youtu.be/54N9MRarrS8 35 947 1208 1356
@MiniXC
MiniXC / ram_police.sh
Last active March 19, 2024 09:54
ram_police.sh
if [ $# -eq 0 ]; then
tmux new-session -d -s ram_police
tmux send-keys -t ram_police "bash ram_police.sh true" ENTER
tmux capture-pane -t ram_police
else
free_ram=$(free -g | grep -m1 -E "[[:digit:]]" | tail -c4)
ram_limit=10
clear
echo "RAM POLICE WITH $ram_limit GB MIN."

possibly later

  • include what the graph is showing in the title (better for screenshots)
  • option to remove outliers (came across some in the data)
  • moving average (although we have to be careful with that)

bigger changes

  • more than one tag at the same time
  • control for tags other than fandom (e.g. a pairing)

small changes

import json
import sys
from accelerate import Accelerator
import torch
from tqdm.auto import tqdm
from datasets import load_dataset
from speech_collator import SpeechCollator
from speech_collator.measures import EnergyMeasure, PitchMeasure, SRMRMeasure, SNRMeasure
from transformers import HfArgumentParser
# add to your bashrc
function pyroblast() {
pkill -f ".*python.*"
pkill -f ".*wandb.*"
accelerate launch "$@"
}