This file contains hidden or 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
| // | |
| // Generated by LLVM NVPTX Back-End | |
| // See scan3 in https://github.com/proger/nanokitchen/blob/main/triscan.py | |
| // | |
| .version 8.1 | |
| .target sm_86 | |
| .address_size 64 | |
| // .globl scan3_0d1d2d |
This file contains hidden or 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 sys | |
| import requests | |
| import json | |
| context = """[INST] They are planning to host a party next weekend. [/INST] Вони планують провести вечірку наступного вікенду. | |
| [INST] I enjoy swimming in the ocean and feeling the salty breeze. [/INST] Мені подобається плавати в океані та відчувати солоний вітер. | |
| [INST]""" | |
| # docker run --gpus all -p 8000:8000 -e HF_HOME=/hf -e CUDA_VISIBLE_DEVICES=1 -v ~/.cache/huggingface:/hf ghcr.io/mistralai/mistral-src/vllm:latest --host 0.0.0.0 --model mistralai/Mistral-7B-v0.1 | |
| def prompt(input, url="http://localhost:8000/v1/completions"): |
This file contains hidden or 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 | |
| from torch.utils.data import DataLoader, TensorDataset | |
| import gzip | |
| import numpy as np | |
| torch.set_float32_matmul_precision('high') | |
| def read(filename): |
This file contains hidden or 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 gzip | |
| import numpy as np | |
| from sklearn.cluster import MiniBatchKMeans | |
| def read(filename): | |
| with gzip.open(filename, 'rb') as file: | |
| compressed_data = file.read() | |
| data = np.frombuffer(compressed_data, dtype=np.float32) | |
| return data |
This file contains hidden or 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 module sets phasors to stun using gradient descent" | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.utils.parametrize as parametrize | |
| tau = 6.28 | |
| stun = 0.25*tau | |
| class Cyclic(nn.Module): | |
| def forward(self, x): |
This file contains hidden or 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 patch makes robomaster_sim work with Coppelia 4.6 | |
| diff --git a/CMakeLists.txt b/CMakeLists.txt | |
| index 03c1ab6..be6e2cf 100644 | |
| --- a/CMakeLists.txt | |
| +++ b/CMakeLists.txt | |
| @@ -11,7 +11,7 @@ IF (WIN32) | |
| ELSE() | |
| set(CMAKE_CXX_STANDARD 17) |
This file contains hidden or 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
| "accumulate repeating characters: convolution frontend, RNN backend" | |
| import collections | |
| from itertools import islice | |
| def conv(iterable, n=2): | |
| "1d convolution" | |
| it = iter(iterable) | |
| window = collections.deque(islice(it, n-1), maxlen=n) | |
| for x in it: |
This file contains hidden or 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 | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| def forward_rnn(forget, input, output, hidden, T, x): | |
| outputs = [] | |
| for t in range(T): | |
| u = input(x[:, t, :]) |
This file contains hidden or 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 | |
| import torch.nn as nn | |
| def forward_rnn(forget, input, output, hidden, T, x): | |
| outputs = [] | |
| for t in range(T): | |
| hidden = (forget(hidden) + input(x[:, t, :])).relu() | |
| outputs.append(output(hidden)) |
This file contains hidden or 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 | |
| import torch.nn as nn | |
| import math | |
| def scan0(f, x): | |
| y = [torch.zeros_like(x[..., 0])] | |
| for i in range(0, x.size(-1)): | |
| y.append(f*y[..., i-1] + x[..., i]) | |
| return torch.stack(y, dim=-1) |