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
@I.ir_module | |
class Module: | |
@T.prim_func | |
def main(var_A: T.handle, B: T.Buffer((768, 384), "int8"), Scale: T.Buffer((768, 3), "float16"), Zeros: T.Buffer((768, 3), "float16"), var_D: T.handle): | |
T.func_attr({"dequantize_info": {"B_decode": {"decode_block": "B_decode", "fast_decoding": T.bool(False), "group_size": 256, "source_format": {"bits": 4, "format": "uint"}, "storage_dtype": "int8", "target_format": "float16", "with_scaling": T.bool(True), "with_zeros": T.bool(True), "zeros_mode": "rescale"}}, "dlight.tensorcore_prenormlized": T.bool(True), "opt_shapes": {"m": [2, 12]}, "tir.is_scheduled": 1, "tir.noalias": T.bool(True)}) | |
m = T.int32() | |
A = T.match_buffer(var_A, (m, 768), "float16") | |
D = T.match_buffer(var_D, (m, 768), "float16") | |
# with T.block("root"): | |
A_reindex_pad_shared_dyn = T.alloc_buffer((1, (m + 127) // 128 * 128, 768), "float16", scope="shared.dyn") |
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
%pip install ipympl | |
%matplotlib ipympl | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.widgets import Slider | |
# draw initial triangle | |
triangle = np.array([ | |
[1, 4, 1, 1], |
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
# pip install git+https://github.com/suno-ai/bark.git && pip uninstall -y torch torchvision torchaudio && pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu118 | |
text_prompt = """ | |
For all neural retrievers, we fine-tune them on top of a further-pretrained backbone using a batched triplets. | |
It contains a query q, and a pair of positive and negative passages, p plus and p minus. | |
we use passages of other training instances as additional negatives, which is a common practice to get more training samples for free, basically. | |
""" | |
from bark import SAMPLE_RATE, generate_audio, preload_models |
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
# clone pytorch at b004c0b3c6a1ee39ba0b512a00d95e7f83852556 with all submodules. | |
git clone -b main --recursive https://github.com/pytorch/pytorch | |
cd pytorch | |
inotifywait --event create -rm /home/tk/anaconda3/envs/pytorch-ref/ | |
conda deactivate | |
conda env remove -n pytorch-src | |
conda create -n pytorch-src python=3.11 |
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
conda create --name llama -c conda-forge python=3.8 | |
conda activate llama | |
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu118 | |
python -c 'import torch; print(torch.cuda.is_available())' | |
conda install -c conda-forge gxx_linux-64=10.4.0 | |
conda install cuda -c nvidia/label/cuda-11.8.0 | |
#pip install packaging flash-attn |
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 random | |
class TreapNode(object): | |
def __init__(self, key, data): | |
self.key = key | |
self.ran = random.random() | |
self.size = 1 | |
self.cnt = 1 | |
self.data = data | |
self.left = None |
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 nn | |
import transformers | |
from transformers import BertLayer | |
from transformers.models.bert.modeling_bert import BertOnlyMLMHead | |
from transformers import BertTokenizer | |
from transformers import BertForPreTraining | |
class CondensorPretraining(nn.Module): | |
def __init__(self, n_dec_layers=2, skip_from=0): |
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
# Download the binary from: | |
# | |
# and chmod +x. | |
k2pdfopt -ui- -mode copy -x ./eqEmb.pdf | |
k2pdfopt -ui- -mode copy -x -p 679-707 ./d2l-zh-pytorch.pdf | |
# sudo pacman -S pdftk | |
pdftk pml1_k2opt.pdf cat 1-338 output pml1_k2opt_chap1_Foundations.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
ps -up `nvidia-smi -q -x | grep -Po '(?<=<pid>)[0-9]+'` |
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
# See https://github.com/facebookresearch/faiss/blob/main/INSTALL.md#step-1-invoking-cmake | |
PREFIX=/gpfs/fs1/home/j/jimmylin/w32zhong/.conda/envs/py38/powerpc64le-conda_cos7-linux-gnu | |
#MYLIB=/gpfs/fs1/home/j/jimmylin/w32zhong/OpenBLAS-0.3.17/libopenblas.a | |
MYLIB=/gpfs/fs1/home/j/jimmylin/w32zhong/faiss/flexiblas-3.0.3/build/lib/libflexiblas.so | |
module load cmake/3.19.8 | |
cmake -B build . -DFAISS_ENABLE_GPU=OFF -DBLAS_LIBRARIES=$MYLIB -DLAPACK_LIBRARIES=$MYLIB -DBUILD_SHARED_LIBS=OFF | |
make -C build -j faiss VERBOSE=1 |
NewerOlder