# Install OpenSSL 1.1.1
cd /opt
curl https://ftp.openssl.org/source/old/1.1.1/openssl-1.1.1j.tar.gz --output openssl.tar.gz
tar xzf openssl.tar.gz
rm openssl.tar.gz
cd openssl-1.1.1j/
./config --prefix=/opt/openssl && make && make install
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
Follow the instructions | |
https://github.com/Syllo/nvtop?tab=readme-ov-file#nvtop-build | |
cmake .. -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=OFF -DINTEL_SUPPORT=OFF -DMSM_SUPPORT=OFF -DPANFROST_SUPPORT=OFF -DPANTHOR_SUPPORT=OFF |
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
# https://fa.bianp.net/blog/2015/holdout-cross-validation-generator/ | |
import numpy as np | |
from sklearn.utils import check_random_state | |
class HoldOut: | |
""" | |
Hold-out cross-validator generator. In the hold-out, the | |
data is split only once into a train set and a test set. | |
Unlike in other cross-validation schemes, the hold-out |
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 collections import OrderedDict | |
import math | |
from typing import List, Tuple | |
import torch | |
import torch.jit as jit | |
import torch.nn as nn | |
from torch.nn import Parameter | |
from torch import Tensor |
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
''' Script for downloading all GLUE data. | |
Note: for legal reasons, we are unable to host MRPC. | |
You can either use the version hosted by the SentEval team, which is already tokenized, | |
or you can download the original data from (https://download.microsoft.com/download/D/4/6/D46FF87A-F6B9-4252-AA8B-3604ED519838/MSRParaphraseCorpus.msi) and extract the data from it manually. | |
For Windows users, you can run the .msi file. For Mac and Linux users, consider an external library such as 'cabextract' (see below for an example). | |
You should then rename and place specific files in a folder (see below for an example). | |
mkdir MRPC | |
cabextract MSRParaphraseCorpus.msi -d MRPC |
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 torch | |
from torch import Tensor | |
import torch.nn as nn | |
class OHEM(nn.Module): | |
""" | |
Online hard example mining. | |
Details: <https://arxiv.org/pdf/1604.03540.pdf> | |
""" |
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
# based on https://medium.com/the-dl/how-to-use-pytorch-hooks-5041d777f904 | |
class VerboseExecution(nn.Module): | |
def __init__(self, model: nn.Module): | |
super().__init__() | |
self.model = model | |
# Register a hook for each layer | |
for name, layer in self.model.named_children(): |
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
# https://stackoverflow.com/a/27737385/3960038 | |
from functools import wraps | |
from time import time | |
def timing(f): | |
@wraps(f) | |
def wrap(*args, **kw): | |
ts = time() | |
result = f(*args, **kw) |
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 asyncio | |
import aiohttp | |
async def fetch(session, url): | |
async with session.get(url) as response: | |
return await response.text() | |
async def consumer(queue, session): |
sudo curl -o /usr/local/bin/rmate https://raw.githubusercontent.com/aurora/rmate/master/rmate
sudo chmod +x /usr/local/bin/rmate
sudo mv /usr/local/bin/rmate /usr/local/bin/subl
NewerOlder