repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/load.py
src/rwkvstic/load.py
from rwkvstic.agnostic.agnosticRwkv import AgnosticRWKV from rwkvstic.agnostic.rnn import RnnRWKV from rwkvstic.helpers.loadWeights import loadWeights from rwkvstic.agnostic.backends import Backends from rwkvstic.interOpLoaders import tflite, torchscript, prequantized, preJax, rwkvRs, onnx, chatRWKV from rwkvstic.rwk...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/preQuantize.py
src/rwkvstic/preQuantize.py
from rwkvstic.helpers.loadWeights import loadWeights from rwkvstic.rwkvMaster import RWKVMaster import torch import gc import inquirer import os # set torch threads to 8 torch.set_num_threads(8) def preQuantized(path=None, chunksize=32, useLogFix=True) -> RWKVMaster: if (path == None): files = os.list...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/preJax.py
src/rwkvstic/preJax.py
from rwkvstic.helpers.loadWeights import loadWeights from rwkvstic.rwkvMaster import RWKVMaster import torch import gc import inquirer import os # set torch threads to 8 torch.set_num_threads(8) def preJax(path=None) -> RWKVMaster: if (path == None): files = os.listdir() # filter by ending in ...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/__main__.py
src/rwkvstic/__main__.py
from sys import argv if __name__ == '__main__': import rwkvstic.preQuantize as pq import rwkvstic.preJax as pj args = { "chunksize": 32 if "--cs" not in argv else int(argv[-1].split("=")[1]), "useLogFix": "--nologfix" not in argv, } if ("--server" in argv): import rwkvstic.s...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/rwkvMaster.py
src/rwkvstic/rwkvMaster.py
import tqdm import rwkvstic.tokenizer as tokenizer from typing import List # this is for like, being useful import time def clone (x): return x.clone() if hasattr(x, "clone") else x class RWKVMaster(): def __init__(self, model, emptyState, initTensor=lambda x: x, intTensor=lambda x: x, sampler=None, tokP...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/bench.py
src/rwkvstic/bench.py
import time import torch from rwkvstic.load import RWKV def bechmark(): # choose a file to load with the file picker dialog import tkinter as tk from tkinter import filedialog root = tk.Tk() root.withdraw() file_path = filedialog.askopenfilename( initialdir = "./", title = "Sele...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/__init__.py
src/rwkvstic/__init__.py
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/server.py
src/rwkvstic/server.py
# command = python3 -m rwkvstic --server **args import torch from sys import argv def fixDtype(x): return torch.float32 if x == "float32" else torch.float64 if x == "float64" else torch.bfloat16 if x == "bfloat16" else torch.float16 if x == "float16" else x def fixNumbers(x): return int(x) if type(x) == str and x.is...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/tools/getBestSetup.py
src/rwkvstic/tools/getBestSetup.py
import torch mat = torch.randn(1000, 1000).float().cuda() vec = torch.randn(1000).float().cuda() matbfloat = mat.bfloat16().cuda() vecbfloat = vec.bfloat16().cuda() mathalf = mat.half().cuda() vechalf = vec.half().cuda() rounds = 1000 # warmup for i in range(1000): x = torch.mv(mat, vec) # time the bfloat16 ma...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/tools/getBestSetupCpu.py
src/rwkvstic/tools/getBestSetupCpu.py
import time import torch mat = torch.randn(1000, 1000).float() vec = torch.randn(1000).float() matbfloat = mat.bfloat16() vecbfloat = vec.bfloat16() matdouble = mat.double() vecdouble = vec.double() rounds = 1000 # warmup for i in range(1000): x = torch.mv(mat, vec) # time the bfloat16 matmul start = time.t...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/rnn.py
src/rwkvstic/agnostic/rnn.py
from rwkvstic.agnostic.backends.base import module from typing import Dict def RnnRWKV(ops: module, *args): class myRWKV(ops.module): @ ops.initfunc def __init__(self, w: Dict[str, ops.TensorType]): super(myRWKV, self).__init__() print("Legacy RWKV") self.ops ...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/agnosticRwkv.py
src/rwkvstic/agnostic/agnosticRwkv.py
from rwkvstic.agnostic.backends.base import module from typing import Dict, List import torch # allow tensor core ops torch.backends.cudnn.benchmark = True # allow fp16 ops torch.backends.cudnn.allow_tf32 = True # allow use of cuDNN torch.backends.cudnn.enabled = True def AgnosticRWKV(ops: module, *args): class m...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/__init__.py
src/rwkvstic/agnostic/__init__.py
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/samplers/typical.py
src/rwkvstic/agnostic/samplers/typical.py
def typical(logits, temp=1.0, tau=0.95, **kwargs): import torch # do it in pytorch import numpy as np probs = torch.nn.functional.softmax(logits.float(), dim=-1) logits = -torch.log(probs) ent = torch.nansum(logits * probs, dim=-1, keepdim=True) shifted_logits = torch...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/samplers/numpy.py
src/rwkvstic/agnostic/samplers/numpy.py
def npsample(ozut, temp: float = 1.0, top_p_usual: float = 0.8) -> int: import numpy as np from scipy.special import softmax try: ozut = ozut.numpy() except: try: ozut = ozut.cpu().numpy() except: ozut = np.array(ozut) # out[self.UNKNOWN_CHAR] = -f...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/samplers/__init__.py
src/rwkvstic/agnostic/samplers/__init__.py
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/samplers/torch.py
src/rwkvstic/agnostic/samplers/torch.py
def torchsample(ozut, temp=1.0, top_p_usual=0.8) -> int: import torch # do it in pytorch probs = torch.softmax(ozut, dim=-1) sorted_probs, indices = torch.sort(probs, descending=True) cumulative_probs = torch.cumsum(sorted_probs, dim=-1) cutoff = sorted_probs[torch.argmax( cumulative_pr...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/opt.py
src/rwkvstic/agnostic/backends/opt.py
import torch from rwkvstic.agnostic.backends.modules.matmul import Linear from rwkvstic.agnostic.backends.modules.layernorm import LayerNorm from rwkvstic.agnostic.backends.modules.block import Block from rwkvstic.agnostic.backends.modules.emb import RwkvEmb, RwkvModule from tqdm import tqdm import os current_path = ...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/jax.py
src/rwkvstic/agnostic/backends/jax.py
import rwkvstic.agnostic.backends.base as RWKVOp class RWKVNumpyOps(RWKVOp.module): def __init__(self, layers, embed, *args, **kwargs): import numpy as np super().__init__(layers, embed, *args, **kwargs) self.initTensor = lambda x: x.float().cpu().numpy() self.sqrt = np.sqr...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/tensorflow.py
src/rwkvstic/agnostic/backends/tensorflow.py
import inquirer import os import rwkvstic.agnostic.backends.base as RWKVOp class RWKVTFOps(RWKVOp.module): def __init__(self, layers, embed, *args, useGPU: bool = None, **kwargs): try: import tensorflow as tf except: inst = inquirer.confirm( "Tensorflow not ...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/coreml.py
src/rwkvstic/agnostic/backends/coreml.py
from rwkvstic.agnostic.backends.base import module class RWKVCoreMLOps(module): def __init__(self, layers, embed, *args, **kwargs): super().__init__(layers, embed, *args, **kwargs) from coremltools.converters.mil.mil import Builder as mb from coremltools.converters.mil.mil import Program,...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/__init__.py
src/rwkvstic/agnostic/backends/__init__.py
from rwkvstic.agnostic.backends.torch import RWKVCudaOps, RWKVPTTSExportOps, RWKVCudaDeepspeedOps, RWKVMpsOps from rwkvstic.agnostic.backends.jax import RWKVJaxOps, RWKVNumpyOps, RWKVCuPyOps, RWKVCuPyQuantOps from rwkvstic.agnostic.backends.tensorflow import RWKVTFExport, RWKVTFOps from rwkvstic.agnostic.backends.base ...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/torch.py
src/rwkvstic/agnostic/backends/torch.py
from typing import List, Union import rwkvstic.agnostic.backends.base as RWKVOp class RWKVPTOps(RWKVOp.module): def __init__(self, layers, embed, *args, dtype=None, **kwargs): import torch import inquirer super().__init__(layers, embed, dtype=dtype, *args, **kwargs) q = [inquir...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/base.py
src/rwkvstic/agnostic/backends/base.py
from typing import List, Dict, Union class module: def __init__(self, layers, embed, *args, useLogFix=True, **kwargs): from rwkvstic.agnostic.samplers.numpy import npsample self.VectorType = List[float] self.useLogFix = useLogFix self.MatrixType = List[List[float]] self.Te...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/onnx.py
src/rwkvstic/agnostic/backends/onnx.py
import numpy as np import rwkvstic.agnostic.backends.base as RWKVOp class RWKVOnnxOps(RWKVOp.rnnmodule): def __init__(self, layers, embed, *args, dtype=None, **kwargs): import onnx super().__init__(layers, embed, *args, **kwargs) print("embed ", embed) import torch if dt...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/cuda/load.py
src/rwkvstic/agnostic/backends/cuda/load.py
def loadCustomCudaModule(): from torch.utils.cpp_extension import load import os current_path = os.path.dirname(os.path.abspath(__file__)) load( name=f"wkv_cuda", sources=[f"{current_path}/wrapper.cpp", f"{current_path}/operators.cu", f"{current_...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/modules/block.py
src/rwkvstic/agnostic/backends/modules/block.py
from rwkvstic.agnostic.backends.modules.base import RwkvModule from rwkvstic.agnostic.backends.modules.layernorm import LayerNorm from rwkvstic.agnostic.backends.modules.matmul import Linear, Linear3 from rwkvstic.agnostic.backends.modules.wkv import WKV import torch class Block(RwkvModule): def __init__(se...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/modules/layernorm.py
src/rwkvstic/agnostic/backends/modules/layernorm.py
from rwkvstic.agnostic.backends.modules.base import RwkvModule import torch class LayerNorm(RwkvModule): def __init__(self, weight, bias): super(LayerNorm, self).__init__() self.weight = weight.clone().to(torch.float64) self.bias = bias.clone().to(torch.float64) self.device = torch....
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/modules/emb.py
src/rwkvstic/agnostic/backends/modules/emb.py
from rwkvstic.agnostic.backends.modules.base import RwkvModule import torch class RwkvEmb (RwkvModule): def __init__(self,w): super().__init__() self.w = w.clone().cpu() def forward(self,x): return self.w[x.cpu()].to(torch.float64)
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/modules/base.py
src/rwkvstic/agnostic/backends/modules/base.py
import torch class RwkvModule(torch.nn.Module): def __init__(self): super(RwkvModule, self).__init__() self.submodules = [] self.subattributes = [] def add_submodule(self, submodule): self.submodules.append(submodule) def config(self, config): pass
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/modules/matmul.py
src/rwkvstic/agnostic/backends/modules/matmul.py
from rwkvstic.agnostic.backends.modules.base import RwkvModule import torch from typing import List class MM8(RwkvModule): def __init__(self, weight, device, stream = False): super(MM8, self).__init__() self.device = device self.stream = stream ...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/agnostic/backends/modules/wkv.py
src/rwkvstic/agnostic/backends/modules/wkv.py
from rwkvstic.agnostic.backends.modules.base import RwkvModule import torch class CudaWKV(RwkvModule): def __init__(self): super(CudaWKV, self).__init__() self.y = torch.empty((1, 1), device="cpu", memory_format=torch.contiguous_format, dtype=torch.float64) def forward(self, T: int, C: int, w, ...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/interOpLoaders/torchscript.py
src/rwkvstic/interOpLoaders/torchscript.py
from rwkvstic.rwkvMaster import RWKVMaster from rwkvstic.agnostic.samplers.numpy import npsample def initTorchScriptFile(path, tokenizer=None): import torch embed = path.split("-")[2].split(".")[0] layers = path.split("-")[1] mymodel = torch.jit.load(path) device = torch.device("cuda" if "gpu" in ...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/interOpLoaders/preJax.py
src/rwkvstic/interOpLoaders/preJax.py
from rwkvstic.rwkvMaster import RWKVMaster from rwkvstic.agnostic.agnosticRwkv import AgnosticRWKV from rwkvstic.agnostic.backends.jax import RWKVJaxOps def loadPreJax(path, tokenizer=None): import jax weights = jax.numpy.load(path, allow_pickle=True) # filter out the keys that are not .block weight...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/interOpLoaders/chatRWKV.py
src/rwkvstic/interOpLoaders/chatRWKV.py
from rwkvstic.rwkvMaster import RWKVMaster from rwkvstic.agnostic.samplers.numpy import npsample def initRWKVOriginal(path, strategy, tokenizer=None): from rwkv.model import RWKV modell = RWKV(path, strategy) class InterOp(): RnnOnly = False def forward(self, x, y): return m...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/interOpLoaders/__init__.py
src/rwkvstic/interOpLoaders/__init__.py
# these are for testing exported models
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/interOpLoaders/prequantized.py
src/rwkvstic/interOpLoaders/prequantized.py
from rwkvstic.rwkvMaster import RWKVMaster from rwkvstic.agnostic.agnosticRwkv import AgnosticRWKV def loadPreQuantized(path, tokenizer=None): raise "Please use version < 2.0 for .pqth files, >2.0 uses .rwkv files, and is up to 8x faster"
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/interOpLoaders/tflite.py
src/rwkvstic/interOpLoaders/tflite.py
from rwkvstic.rwkvMaster import RWKVMaster from rwkvstic.agnostic.samplers.numpy import npsample def initTFLiteFile(path, tokenizer=None): import tensorflow.lite as tflite import tensorflow as tf interpreter = tflite.Interpreter( model_path=path) interpreter.allocate_tensors() input_det...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/interOpLoaders/rwkvRs.py
src/rwkvstic/interOpLoaders/rwkvRs.py
from rwkvstic.rwkvMaster import RWKVMaster from rwkvstic.agnostic.samplers.numpy import npsample def initRwkvRsFile(model_path, tokenizer=None): import rwkv_rs import huggingface_hub import os if not os.path.exists(model_path): model_path = huggingface_hub.hf_hub_download( repo_id=...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/interOpLoaders/onnx.py
src/rwkvstic/interOpLoaders/onnx.py
from rwkvstic.agnostic.samplers.numpy import npsample from rwkvstic.rwkvMaster import RWKVMaster def initONNXFile(path, tokenizer=None, useAllAvailableProviders=True): import onnxruntime as rt # session execution provider options sess_options = rt.SessionOptions() print(rt.get_available_providers()...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/helpers/loadWeights.py
src/rwkvstic/helpers/loadWeights.py
from rwkvstic.agnostic.backends import Backends from rwkvstic.agnostic.backends.base import module from typing import Dict from tqdm import tqdm import inquirer def loadWeights(mode, path, *args, processEmb=True, **kwargs): import torch n_layer = 0 w: Dict[str, torch.Tensor] = torch.load( path...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/tokenizer/__init__.py
src/rwkvstic/tokenizer/__init__.py
from transformers import PreTrainedTokenizerFast import os path = "20B_tokenizer.json" path = os.path.join(os.path.dirname(__file__), path) def tokenizer(x=None): return PreTrainedTokenizerFast( tokenizer_file=x if x is not None else path)
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/training/model.py
src/rwkvstic/training/model.py
import torch from rwkvstic.training.modules.block import Block class RWKV(torch.nn.Module): def __init__(self,dims,layers, head, T): super(RWKV, self).__init__() print("Training RWKV") # head = 50277 self.emb = torch.nn.Embedding...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/training/modules/block.py
src/rwkvstic/training/modules/block.py
from rwkvstic.training.modules.wkv import wkv_power import torch class Block(torch.nn.Module): def __init__(self, dims,T): super(Block, self).__init__() self.ln1 = torch.nn.LayerNorm((dims,)) self.ln2 = torch.nn.LayerNorm((dims,)) ...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
harrisonvanderbyl/rwkvstic
https://github.com/harrisonvanderbyl/rwkvstic/blob/55826c8d0bdf89ba36bc4eb6518fa736aa479913/src/rwkvstic/training/modules/wkv.py
src/rwkvstic/training/modules/wkv.py
import torch class wkv_power(torch.nn.Module): def __init__(self, dims, T): super(wkv_power, self).__init__() self.time_first = torch.nn.Parameter(torch.randn(dims)) self.time_decay = torch.nn.Parameter(torch.randn(dims)) self.T = T self.register_parameter("time_fi...
python
MIT
55826c8d0bdf89ba36bc4eb6518fa736aa479913
2026-01-05T07:11:22.708425Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/setup.py
setup.py
from setuptools import setup, find_packages with open("README.md", "r", encoding="utf-8") as f: long_description = f.read() setup( name="BiFuncLib", version="1.0.0", description="A Python library for biclustering with functional data", author="Yuhao Zhong", author_email="Barry57@163.com", ...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/docs/source/conf.py
docs/source/conf.py
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/cc_main_func.py
BiFuncLib/cc_main_func.py
import numpy as np from scipy.optimize import minimize_scalar from scipy.interpolate import interp1d from scipy.spatial.distance import pdist, squareform def medoid_evaluation(fun_mat, a, b, const_a, const_b): n, m, p = fun_mat.shape fun_per_medoid = fun_mat.reshape(n * m, p) distance = squareform(pdist(f...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/simulation_data.py
BiFuncLib/simulation_data.py
import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.stats import multivariate_normal, norm from pathlib import Path from GENetLib.fda_func import bspline_mat from GENetLib.fda_func import create_bspline_basis from GENetLib.fda_func import fd from GENetLib.fda_func import eval_fd from BiFu...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/FDPlot.py
BiFuncLib/FDPlot.py
import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import gridspec from GENetLib.fda_func import bspline_mat from GENetLib.fda_func import eval_basis, eval_fd from GENetLib.fda_func import create_bspline_basis, create_fourier_basis from GENetLib.plot_gene import plot_fd import seabor...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
true
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/pf_bifunc.py
BiFuncLib/pf_bifunc.py
import numpy as np import pandas as pd import networkx as nx from GENetLib.fda_func import bspline_mat from scipy.linalg import solve from BiFuncLib.pf_main_func import inv_uty_cal, beta_ini_cal, biclustr_admm from BiFuncLib.AuxFunc import AuxFunc def pf_bifunc( data, nknots, order, gamma1, gamma...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/sas_main_func.py
BiFuncLib/sas_main_func.py
import numpy as np from GENetLib.fda_func import create_bspline_basis, eval_basis, fdpar from sklearn.mixture import GaussianMixture from scipy.cluster.hierarchy import linkage, fcluster from scipy.sparse import csr_matrix from GENetLib.BsplineFunc import BsplineFunc def get_sigma(x, curve, time, S, piigivej, gcov, ...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/cvx_biclus.py
BiFuncLib/cvx_biclus.py
import numpy as np import matplotlib.pyplot as plt import seaborn as sns import warnings from BiFuncLib.cvx_main_func import cobra_validate, cobra_pod, biclust_smooth warnings.filterwarnings( "ignore", category=RuntimeWarning, message="Mean of empty slice" ) # Cluster with validation def cvx_biclus_valid( ...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/cvx_main_func.py
BiFuncLib/cvx_main_func.py
import numpy as np from math import exp, sqrt from scipy.sparse import csc_matrix, coo_matrix import networkx as nx import random import math def kernel_weights(X, phi): p, n = X.shape num_weights = n * (n - 1) // 2 w = np.empty(num_weights, dtype=float) k = 0 for i in range(n - 1): for j ...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/cc_bifunc.py
BiFuncLib/cc_bifunc.py
import numpy as np import pandas as pd import matplotlib.pyplot as plt from BiFuncLib.cc_main_func import bigcc_fun, evaluate_mat_dist, ccscore_fun from BiFuncLib.bimax_biclus import bimax_biclus # Functional Cheng and Church algorithm def cc_bifunc( data, delta, theta=1, template_type="mean", n...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/sas_bifunc.py
BiFuncLib/sas_bifunc.py
import numpy as np import itertools from GENetLib.fda_func import fd from GENetLib.plot_gene import plot_fd from GENetLib.fda_func import create_bspline_basis from BiFuncLib.sas_main_func import ( sasfclust_init, loglik, get_msdrule, get_zero, sasfclust_Mstep, sasfclust_Estep, classify, ) ...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/lbm_main_func.py
BiFuncLib/lbm_main_func.py
import numpy as np from sklearn.cluster import KMeans from scipy.linalg import cholesky, solve, eig import copy from GENetLib.fda_func import create_bspline_basis, create_fourier_basis from GENetLib.fda_func import inprod from GENetLib.BsplineFunc import BsplineFunc from BiFuncLib.fem_bifunc import fem_bifunc def ar...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/local_main_func.py
BiFuncLib/local_main_func.py
import numpy as np from GENetLib.fda_func import create_bspline_basis from GENetLib.fda_func import eval_basis from sklearn.cluster import KMeans from scipy.linalg import norm from itertools import combinations import networkx as nx import math from GENetLib.BsplineFunc import BsplineFunc from BiFuncLib.AuxFunc import...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/AuxFunc.py
BiFuncLib/AuxFunc.py
import numpy as np import pandas as pd import itertools from scipy.sparse import lil_matrix import matplotlib.pyplot as plt class AuxFunc: def __init__(self, n, m=None, x=None, V=None): self.n = n self.m = m if m is not None else None self.x = np.array(x) if x is not None else None ...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/fem_bifunc.py
BiFuncLib/fem_bifunc.py
import numpy as np import warnings from BiFuncLib.fem_main_func import fem_main_func warnings.filterwarnings("ignore", category=RuntimeWarning) # Model-based clustering with the funFEM algorithm def fem_bifunc( fd, K=np.arange(2, 7), model=["AkjBk"], crit="bic", init="kmeans", Tinit=(), ...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/sparse_main_func.py
BiFuncLib/sparse_main_func.py
import numpy as np import math from sklearn.cluster import KMeans from scipy.cluster.hierarchy import linkage, fcluster from sklearn_extra.cluster import KMedoids # Classification error rate function def cer(P, Q): if len(P) != len(Q): raise ValueError("The two partitions must have the same length") c...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/sparse_bifunc.py
BiFuncLib/sparse_bifunc.py
from BiFuncLib.sparse_main_func import ( FKMSparseClustering_permute, FKMSparseClustering, cer, ) def sparse_bifunc(data, x, K, method="kmea", true_clus=None): mscelto = FKMSparseClustering_permute(data.T, x, K, method=method)["m"] result = FKMSparseClustering(data.T, x, K, mscelto, method) if...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/ssvd_main_func.py
BiFuncLib/ssvd_main_func.py
import numpy as np import pandas as pd import math from copy import deepcopy from scipy.sparse.linalg import svds import gc from BiFuncLib.BiclustResult import BiclustResult def thresh(z, delta, thredtype=1, a=3.7): z = np.asarray(z) if thredtype == 1: return ( np.sign(z) * ((...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/local_bifunc.py
BiFuncLib/local_bifunc.py
import numpy as np from BiFuncLib.local_main_func import calculate_gcv, calculate_bic, local_admm def local_bifunc( data, times, lambda1, lambda2, lambda3, opt=False, rangeval=(0, 1), nknots=30, order=4, nu=2, tau=3, K0=6, rep_num=100, kappa=1, eps_outer=0....
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/fem_main_func.py
BiFuncLib/fem_main_func.py
import numpy as np import matplotlib.pyplot as plt from numpy.linalg import inv, svd, pinv from sklearn.cluster import KMeans from sklearn.linear_model import ElasticNet from GENetLib.fda_func import inprod from scipy.cluster.hierarchy import linkage, cut_tree def criteria(loglik, T, prms, n): K = prms["K"] p...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/bimax_biclus.py
BiFuncLib/bimax_biclus.py
import pandas as pd from BiFuncLib.BiclustResult import BiclustResult def apriori_bimax(matrix, minr=2, minc=2, number=100): rows = len(matrix) cols = len(matrix[0]) if rows else 0 row_masks = [] for row in matrix: m = 0 for j, v in enumerate(row): if v: m ...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/__init__.py
BiFuncLib/__init__.py
from .simulation_data import ( pf_sim_data, local_sim_data, cc_sim_data, lbm_sim_data, ) from .simulation_data import ( sas_sim_data, sparse_sim_data, cvx_sim_data, ssvd_sim_data, ) from .BsplineFunc import BsplineFunc from .BiclustResult import BiclustResult from .bcheatmap import bchea...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/pf_main_func.py
BiFuncLib/pf_main_func.py
import numpy as np from scipy.linalg import block_diag from itertools import combinations # Generate the initial values of Beta def beta_ini_cal(oridata_list, Y_list, D_d, n, q, p, gamma1): Beta_list = [] for i in range(n): Beta_i = [] for j in range(q): data_ij = np.array(oridata_...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/lbm_bifunc.py
BiFuncLib/lbm_bifunc.py
import itertools import numpy as np from BiFuncLib.lbm_main_func import lbm_main_func # Model-based clustering with the funLBM algorithm def lbm_bifunc( data, K, L, maxit=50, burn=25, basis_name="fourier", nbasis=15, gibbs_it=3, display=False, init="funFEM", ): if not hasa...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/BsplineFunc.py
BiFuncLib/BsplineFunc.py
import numpy as np from GENetLib.fda_func import fd, inprod, eval_basis, int2lfd from GENetLib.fda_func import ppbspline, ycheck, wtcheck, fdparcheck from scipy.linalg import cholesky, solve, qr, eigh, lstsq # Create a class for b-spline functions class BsplineFunc: def __init__(self, basisobj, Lfdobj=2, rng=None...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/BiclustResult.py
BiFuncLib/BiclustResult.py
import numpy as np class BiclustResult: def __init__(self, params, RowxNumber, NumberxCol, Number, info): self.params = params self.RowxNumber = RowxNumber self.NumberxCol = NumberxCol.T self.Number = Number self.info = info self.cluster_row_sizes = np.sum(RowxNumbe...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/bcheatmap.py
BiFuncLib/bcheatmap.py
import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.patches as patches import matplotlib as mpl from matplotlib.colors import LinearSegmentedColormap def ma_palette(low="blue", mid="white", high="red", k=50): if mid is None: colors = [low, high] else: color...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/BiFuncLib/ssvd_biclus.py
BiFuncLib/ssvd_biclus.py
from BiFuncLib.ssvd_main_func import ssvd_bc, s4vd def s4vd_biclus( data, steps=100, pcerv=0.1, pceru=0.1, ss_thr=(0.6, 0.65), size=0.5, gamm=0, iters=100, nbiclust=10, merr=1e-3, cols_nc=True, rows_nc=True, row_overlap=True, col_overlap=True, row_min=1, ...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/pytest/funlbm_test.py
pytest/funlbm_test.py
import numpy as np import pytest from BiFuncLib.FDPlot import FDPlot import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt from BiFuncLib.simulation_data import lbm_sim_data from BiFuncLib.lbm_bifunc import lbm_bifunc from BiFuncLib.lbm_main_func import ari def _check_lbm_result(res: dict): ass...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/pytest/bimax_test.py
pytest/bimax_test.py
import matplotlib matplotlib.use("Agg") import pytest from BiFuncLib.simulation_data import bimax_sim_data from BiFuncLib.bimax_biclus import bimax_biclus from BiFuncLib.bcheatmap import bcheatmap def test_bimax_full_story(): bimax_simdata = bimax_sim_data() bimax_res = bimax_biclus( bimax_simdata, ...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/pytest/funsas_test.py
pytest/funsas_test.py
import numpy as np import matplotlib matplotlib.use("Agg") from BiFuncLib.simulation_data import sas_sim_data from BiFuncLib.sas_bifunc import sas_bifunc, sas_bifunc_cv from BiFuncLib.FDPlot import FDPlot def _check_sas_result(res): assert isinstance(res, dict) def test_sas_full_story(): sas_simdata_0 = sa...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/pytest/bcheatmap_test.py
pytest/bcheatmap_test.py
import numpy as np import pandas as pd import pytest import matplotlib.pyplot as plt from unittest.mock import patch from BiFuncLib.bcheatmap import bcheatmap, ma_palette @pytest.fixture(scope="session", autouse=True) def no_show(): with patch.object(plt, "show"): yield @pytest.fixture def X(): np.r...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/pytest/funsparse_test.py
pytest/funsparse_test.py
import numpy as np import pytest import matplotlib matplotlib.use("Agg") from BiFuncLib.simulation_data import sparse_sim_data from BiFuncLib.sparse_bifunc import sparse_bifunc from BiFuncLib.FDPlot import FDPlot def _check_sparse_result(res): assert isinstance(res, dict) def test_sparse_sim_data(): n = 10...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/pytest/ssvd_test.py
pytest/ssvd_test.py
import matplotlib matplotlib.use("Agg") import pytest from BiFuncLib.simulation_data import ssvd_sim_data from BiFuncLib.ssvd_main_func import jaccardmat from BiFuncLib.ssvd_biclus import ssvd_biclus, s4vd_biclus from BiFuncLib.bcheatmap import bcheatmap from BiFuncLib.BiclustResult import BiclustResult @pytest.fixt...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/pytest/cvx_test.py
pytest/cvx_test.py
import math import random import numpy as np import pytest import matplotlib matplotlib.use("Agg") from BiFuncLib.simulation_data import cvx_sim_data from BiFuncLib.cvx_main_func import gkn_weights from BiFuncLib.cvx_biclus import cvx_biclus_valid, cvx_biclus_missing @pytest.fixture(scope="session") def data(): ...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/pytest/bspline_test.py
pytest/bspline_test.py
import numpy as np import pytest from BiFuncLib.BsplineFunc import BsplineFunc from GENetLib.fda_func import create_bspline_basis, create_fourier_basis @pytest.fixture def sample_data(): n = 50 argvals = np.linspace(0, 1, n) y = np.sin(2 * np.pi * argvals) + 0.1 * np.random.randn(n) basis = create_bsp...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/pytest/funfem_test.py
pytest/funfem_test.py
import pytest import numpy as np from GENetLib.fda_func import create_fourier_basis from BiFuncLib.fem_bifunc import fem_bifunc from BiFuncLib.simulation_data import fem_sim_data from BiFuncLib.BsplineFunc import BsplineFunc from GENetLib.fda_func import basis_fd from BiFuncLib.FDPlot import FDPlot import matplotlib m...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/pytest/funcc_test.py
pytest/funcc_test.py
import numpy as np import pandas as pd import pytest import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt from BiFuncLib.simulation_data import cc_sim_data from BiFuncLib.cc_bifunc import cc_bifunc, cc_bifunc_cv from BiFuncLib.FDPlot import FDPlot def _check_cc_result(res): assert isinstance(r...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/pytest/funpf_test.py
pytest/funpf_test.py
import pytest import numpy as np import pandas as pd import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt from BiFuncLib.pf_bifunc import pf_bifunc from BiFuncLib.simulation_data import pf_sim_data from BiFuncLib.FDPlot import FDPlot def _check_pf_result(res): assert isinstance(res, dict) ...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
XMU-Kuangnan-Fang-Team/BiFuncLib
https://github.com/XMU-Kuangnan-Fang-Team/BiFuncLib/blob/e7879c4e3c425655ee2aefd1c66c3434a27f068e/pytest/funlocal_test.py
pytest/funlocal_test.py
import numpy as np import matplotlib matplotlib.use("Agg") from BiFuncLib.local_bifunc import local_bifunc from BiFuncLib.simulation_data import local_sim_data from BiFuncLib.FDPlot import FDPlot def _check_local_result(res): assert isinstance(res, dict) def test_local_full_story(): local_simdata = local_s...
python
MIT
e7879c4e3c425655ee2aefd1c66c3434a27f068e
2026-01-05T07:11:22.982774Z
false
williballenthin/process-forest
https://github.com/williballenthin/process-forest/blob/6c7e93a88c8ca24bedebc83a80636351652bccff/setup.py
setup.py
#! /usr/bin/env python from setuptools import setup, find_packages setup( name='process-forest', author='Willi Ballenthin', version='0.1', packages = find_packages(), install_requires=[ 'iso8601', 'lxml', 'python-evtx', 'pytz' ], scripts=[ 'src/proce...
python
Apache-2.0
6c7e93a88c8ca24bedebc83a80636351652bccff
2026-01-05T07:11:27.359579Z
false
williballenthin/process-forest
https://github.com/williballenthin/process-forest/blob/6c7e93a88c8ca24bedebc83a80636351652bccff/src/process_forest.py
src/process_forest.py
#!/usr/bin/env python import logging import datetime from collections import namedtuple import pytz import json import iso8601 from lxml import etree from lxml.etree import XMLSyntaxError from Evtx.Evtx import Evtx from Evtx.Views import evtx_file_xml_view g_logger = logging.getLogger("process-forest.global") de...
python
Apache-2.0
6c7e93a88c8ca24bedebc83a80636351652bccff
2026-01-05T07:11:27.359579Z
false
wmylxmj/Anime-Super-Resolution
https://github.com/wmylxmj/Anime-Super-Resolution/blob/c854227efcee961151721032c0ecfc4317f989e4/train.py
train.py
# -*- coding: utf-8 -*- """ Created on Sun Apr 28 18:32:15 2019 @author: wmy """ import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from PIL import Image from keras import backend as K from keras.losses import mean_absolute_error, mean_squared_error from keras.models import load_model from ker...
python
MIT
c854227efcee961151721032c0ecfc4317f989e4
2026-01-05T07:09:39.829800Z
false
wmylxmj/Anime-Super-Resolution
https://github.com/wmylxmj/Anime-Super-Resolution/blob/c854227efcee961151721032c0ecfc4317f989e4/model.py
model.py
# -*- coding: utf-8 -*- """ Created on Sun Apr 28 18:29:04 2019 @author: wmy """ import numpy as np import tensorflow as tf from keras import backend as K from keras.layers import Add, Conv2D, Input, Lambda, Activation from keras.models import Model def SubpixelConv2D(scale, **kwargs): return Lambda(lambda x: tf...
python
MIT
c854227efcee961151721032c0ecfc4317f989e4
2026-01-05T07:09:39.829800Z
false
wmylxmj/Anime-Super-Resolution
https://github.com/wmylxmj/Anime-Super-Resolution/blob/c854227efcee961151721032c0ecfc4317f989e4/optimizer.py
optimizer.py
# -*- coding: utf-8 -*- """ Created on Wed Apr 24 21:30:14 2019 @author: wmy """ import tensorflow as tf from keras import backend as K from keras.optimizers import Adam from tqdm import tqdm class AdamWithWeightsNormalization(Adam): def get_updates(self, loss, params): grads = self.get_gradients(lo...
python
MIT
c854227efcee961151721032c0ecfc4317f989e4
2026-01-05T07:09:39.829800Z
false
wmylxmj/Anime-Super-Resolution
https://github.com/wmylxmj/Anime-Super-Resolution/blob/c854227efcee961151721032c0ecfc4317f989e4/utils.py
utils.py
# -*- coding: utf-8 -*- """ Created on Sun Apr 28 15:36:37 2019 @author: wmy """ import numpy as np import matplotlib.pyplot as plt import os import random from PIL import Image from PIL import ImageFilter class DataLoader(object): def __init__(self, scale=4, crop_size=96, name=None): self.__scale =...
python
MIT
c854227efcee961151721032c0ecfc4317f989e4
2026-01-05T07:09:39.829800Z
false
wmylxmj/Anime-Super-Resolution
https://github.com/wmylxmj/Anime-Super-Resolution/blob/c854227efcee961151721032c0ecfc4317f989e4/evaluate.py
evaluate.py
# -*- coding: utf-8 -*- """ Created on Tue Apr 30 21:24:36 2019 @author: wmy """ import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from PIL import Image from keras import backend as K from keras.losses import mean_absolute_error, mean_squared_error from keras.models import load_model from ker...
python
MIT
c854227efcee961151721032c0ecfc4317f989e4
2026-01-05T07:09:39.829800Z
false
wmylxmj/Anime-Super-Resolution
https://github.com/wmylxmj/Anime-Super-Resolution/blob/c854227efcee961151721032c0ecfc4317f989e4/predict.py
predict.py
# -*- coding: utf-8 -*- """ Created on Tue Apr 30 20:28:04 2019 @author: wmy """ import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from PIL import Image from keras import backend as K from keras.losses import mean_absolute_error, mean_squared_error from keras.models import load_model from ker...
python
MIT
c854227efcee961151721032c0ecfc4317f989e4
2026-01-05T07:09:39.829800Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/setup.py
setup.py
import os import os.path as osp import shutil import sys import warnings from setuptools import find_packages, setup def readme(): with open('README.md', encoding='utf-8') as f: content = f.read() return content version_file = 'mmocr/version.py' is_windows = sys.platform == 'win32' def add_mim_ext...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/train.py
tools/train.py
#!/usr/bin/env python # Copyright (c) OpenMMLab. All rights reserved. import argparse import copy import os import os.path as osp import time import warnings import mmcv import torch import torch.distributed as dist from mmcv import Config, DictAction from mmcv.runner import get_dist_info, init_dist, set_random_seed f...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/publish_model.py
tools/publish_model.py
#!/usr/bin/env python # Copyright (c) OpenMMLab. All rights reserved. import argparse import subprocess import torch def parse_args(): parser = argparse.ArgumentParser( description='Process a checkpoint to be published') parser.add_argument('in_file', help='input checkpoint filename') parser.add_...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/benchmark_processing.py
tools/benchmark_processing.py
#!/usr/bin/env python # Copyright (c) OpenMMLab. All rights reserved. """This file is for benchmark data loading process. It can also be used to refresh the memcached cache. The command line to run this file is: $ python -m cProfile -o program.prof tools/analysis/benchmark_processing.py configs/task/method/[config fil...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/kie_test_imgs.py
tools/kie_test_imgs.py
#!/usr/bin/env python # Copyright (c) OpenMMLab. All rights reserved. import argparse import ast import os import os.path as osp import mmcv import numpy as np import torch from mmcv import Config from mmcv.image import tensor2imgs from mmcv.parallel import MMDataParallel from mmcv.runner import load_checkpoint from ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/analyze_logs.py
tools/analyze_logs.py
# Copyright (c) OpenMMLab. All rights reserved. """Modified from https://github.com/open- mmlab/mmdetection/blob/master/tools/analysis_tools/analyze_logs.py.""" import argparse import json from collections import defaultdict import matplotlib.pyplot as plt import numpy as np import seaborn as sns def cal_train_time(...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/recog_test_imgs.py
tools/recog_test_imgs.py
#!/usr/bin/env python # Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import shutil import time from argparse import ArgumentParser from itertools import compress import mmcv from mmcv.utils import ProgressBar from mmocr.apis import init_detector, model_inference from mmocr.core.evaluation.ocr_m...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false