Skip to content

Instantly share code, notes, and snippets.

View Anjum48's full-sized avatar

Anjum Sayed Anjum48

View GitHub Profile
@Anjum48
Anjum48 / deploy_2024-12-02.log
Created December 2, 2024 20:33
Cloudflare Deploy Log 2024-12-02
2024-12-02T06:06:10.717551Z Cloning repository...
2024-12-02T06:06:23.861517Z From https://github.com/Anjum48/tapesearch
2024-12-02T06:06:23.862039Z * branch 2e000ede8c426e678fb5e6f93d7caf6615eeeff3 -> FETCH_HEAD
2024-12-02T06:06:23.862266Z
2024-12-02T06:06:24.106674Z HEAD is now at 2e000ed Auto-merge sitemaps branch into main on 2024-12-02
2024-12-02T06:06:24.107145Z
2024-12-02T06:06:24.18439Z
2024-12-02T06:06:24.185004Z Using v2 root directory strategy
2024-12-02T06:06:24.206725Z Success: Finished cloning repository files
2024-12-02T06:06:25.769784Z Checking for configuration in a wrangler.toml configuration file (BETA)
@Anjum48
Anjum48 / deploy_2024-11-26.log
Created December 2, 2024 20:31
Cloudflare Deploy Log 2024-11-26
2024-11-26T21:00:36.244234Z Cloning repository...
2024-11-26T21:00:49.423279Z From https://github.com/Anjum48/tapesearch
2024-11-26T21:00:49.423792Z * branch 7e8db798b4b8cc3682e0dbd8ce3374cffcb04e88 -> FETCH_HEAD
2024-11-26T21:00:49.423928Z
2024-11-26T21:00:49.674545Z HEAD is now at 7e8db79 Merge pull request #525 from Anjum48/dev
2024-11-26T21:00:49.675079Z
2024-11-26T21:00:49.75814Z
2024-11-26T21:00:49.758685Z Using v2 root directory strategy
2024-11-26T21:00:49.78507Z Success: Finished cloning repository files
2024-11-26T21:00:51.242166Z Checking for configuration in a wrangler.toml configuration file (BETA)
@Anjum48
Anjum48 / fresh_install.sh
Last active August 23, 2024 08:16
Instructions for a fresh Ubuntu 22.04 install
sudo apt update && sudo apt upgrade -y
sudo apt -y install build-essential git zsh python3-pip gnome-shell-extension-manager openssh-server curl nodejs htop mdadm ffmpeg lm-sensors npm tree
sudo apt -y install linux-headers-$(uname -r)
sudo apt-key del 7fa2af80
# Latest driver download
# https://www.nvidia.co.uk/download/driverResults.aspx/205541/en-uk
wget https://uk.download.nvidia.com/XFree86/Linux-x86_64/535.54.03/NVIDIA-Linux-x86_64-535.54.03.run
import numpy as np
import matplotlib.pyplot as plt
import random
import matplotlib.animation as animation
from matplotlib import cm
# s curve function
def _f(a,b,c,t):
return c*1/(1+a*np.exp(-b*t))
# function for s curve with added noise
@Anjum48
Anjum48 / hard_sample_mining.py
Created July 8, 2020 06:24
Hard sample mining in PyTorch
class HardMiningBatchSampler(BatchSampler):
"""
Creates batches that only contain a class once and and chosen based on embedding distance.
Used for NPairLoss
"""
def __init__(self, labels, batch_size, drop_last=True, classes=None):
self.labels = labels
self.batch_size = batch_size
# self.C = batch_size * 2 if classes is None else classes
@Anjum48
Anjum48 / nested_cv_wrapper.py
Created February 5, 2020 06:13
A first pass of a Nested CV wrapper for category encoders
from category_encoders import utils
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.model_selection import StratifiedKFold
import category_encoders as encoders
import pandas as pd
import numpy as np
import copy
class NestedCVWrapper(BaseEstimator, TransformerMixin):
@Anjum48
Anjum48 / siamese_train.py
Last active January 16, 2019 06:02
PyTorch crashes
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
@Anjum48
Anjum48 / ddpg_gym.py
Last active May 15, 2019 13:03
Pendulum-v0 submission using DDPG without batch normalisation
"""
Implementation of DDPG - Deep Deterministic Policy Gradient
Algorithm and hyperparameter details can be found here: http://arxiv.org/pdf/1509.02971v2.pdf
Variance scaling paper: https://arxiv.org/pdf/1502.01852v1.pdf
Thanks to GitHub users yanpanlau, pemami4911, songrotek and JunhongXu for their DDPG examples
Batch normalisation on the actor accelerates learning but has poor long term stability. Applying to the critic breaks
it, particularly on the state branch. Not sure why but I think this issue is specific to this environment
"""
import numpy as np