repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/learning/add_agent.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:23.608653 | import numpy as np
import torch
import learning.amp_agent as amp_agent
import learning.add_model as add_model
import util.torch_util as torch_util
import learning.diff_normalizer as diff_normalizer
class ADDAgent(amp_agent.AMPAgent):
def __init__(self, config, env, device):
super().__init__(config, env, d... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/envs/task_steering_env.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:23.610013 | import torch
import numpy as np
import envs.smp_env as smp_env
import engines.engine as engine
import util.torch_util as torch_util
class TaskSteeringEnv(smp_env.SMPEnv):
def __init__(self, env_config, engine_config, num_envs, device, visualize, record_video=False):
self._rand_tar_dir = env_config.get("r... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/envs/task_location_env.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:24.542842 | import numpy as np
import torch
import engines.engine as engine
import envs.smp_env as smp_env
import util.torch_util as torch_util
class TaskLocationEnv(smp_env.SMPEnv):
def __init__(self, env_config, engine_config, num_envs, device, visualize, record_video=False):
self._tar_speed = env_config["tar_speed... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/learning/amp_model.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:24.585384 | import torch
import learning.nets.net_builder as net_builder
import learning.ppo_model as ppo_model
import util.torch_util as torch_util
class AMPModel(ppo_model.PPOModel):
def __init__(self, config, env):
super().__init__(config, env)
return
def eval_disc(self, disc_obs):
h = sel... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/learning/base_model.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:26.150052 | import gymnasium.spaces as spaces
import numpy as np
import torch
import learning.distribution_gaussian_diag as distribution_gaussian_diag
import learning.distribution_categorical as distribution_categorical
import util.torch_util as torch_util
class BaseModel(torch.nn.Module):
def __init__(self, config, env):
... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/learning/awr_model.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:26.151989 | import torch
import learning.base_model as base_model
import learning.nets.net_builder as net_builder
import util.torch_util as torch_util
class AWRModel(base_model.BaseModel):
def __init__(self, config, env):
super().__init__(config, env)
self._build_nets(config, env)
return
def eva... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/learning/ase_model.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:26.152539 | import gymnasium.spaces as spaces
import numpy as np
import torch
import learning.nets.net_builder as net_builder
import learning.amp_model as amp_model
import util.torch_util as torch_util
class ASEModel(amp_model.AMPModel):
def __init__(self, config, env):
super().__init__(config, env)
return
... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/learning/awr_agent.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:26.780947 | import numpy as np
import torch
import envs.base_env as base_env
import learning.base_agent as base_agent
import learning.awr_model as awr_model
import learning.mp_optimizer as mp_optimizer
import learning.rl_util as rl_util
import util.mp_util as mp_util
import util.torch_util as torch_util
class AWRAgent(base_agent... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/learning/dummy_agent.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:26.935287 | import gymnasium.spaces as spaces
import torch
import learning.base_agent as base_agent
import util.torch_util as torch_util
class DummyAgent(base_agent.BaseAgent):
def __init__(self, env, device):
super().__init__(None, env, device)
return
def _get_exp_buffer_length(self):
return 32... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/learning/amp_agent.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:28.578849 | import numpy as np
import torch
import learning.amp_model as amp_model
import learning.experience_buffer as experience_buffer
import learning.mp_optimizer as mp_optimizer
import learning.normalizer as normalizer
import learning.ppo_agent as ppo_agent
import util.torch_util as torch_util
class AMPAgent(ppo_agent.PPOAg... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/learning/ase_agent.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:28.879686 | import numpy as np
import torch
import learning.amp_agent as amp_agent
import learning.ase_model as ase_model
import learning.base_agent as base_agent
import learning.mp_optimizer as mp_optimizer
import learning.rl_util as rl_util
import util.mp_util as mp_util
import util.torch_util as torch_util
import envs.base_env... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/learning/diff_normalizer.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:29.157518 | import numpy as np
import torch
import util.mp_util as mp_util
from util.logger import Logger
class DiffNormalizer(torch.nn.Module):
def __init__(self, shape, device, init_mean=None, min_diff=1e-4, clip=np.inf, dtype=torch.float):
super().__init__()
self._min_diff = min_diff
self._clip = ... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/learning/base_agent.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:29.256344 | import abc
import enum
import gymnasium.spaces as spaces
import numpy as np
import os
import time
import torch
import envs.base_env as base_env
import learning.experience_buffer as experience_buffer
import learning.mp_optimizer as mp_optimizer
import learning.normalizer as normalizer
import learning.return_tracker as ... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/learning/distribution_gaussian_diag.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:30.420473 | import enum
import numpy as np
import torch
class StdType(enum.Enum):
FIXED = 0
CONSTANT = 1
VARIABLE = 2
class DistributionGaussianDiagBuilder(torch.nn.Module):
def __init__(self, in_size, out_size, std_type, init_std, init_output_scale=0.01):
super().__init__()
self._std_type = std_t... |
xbpeng/MimicKit | https://github.com/xbpeng/MimicKit | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | mimickit/learning/distribution_categorical.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:30.421151 | import torch
class DistributionCategoricalBuilder(torch.nn.Module):
def __init__(self, in_size, out_size, init_output_scale=0.01):
super().__init__()
self._build_params(in_size, out_size, init_output_scale)
return
def _build_params(self, in_size, out_size, init_output_scale):
s... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | exp/exp_anomaly_detection.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:32.640447 | from torch.optim import lr_scheduler
from data_provider.data_factory import data_provider
from exp.exp_basic import Exp_Basic
from utils.tools import EarlyStopping, adjust_learning_rate, adjustment
from sklearn.metrics import precision_recall_fscore_support
from sklearn.metrics import accuracy_score
import torch.multi... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | exp/exp_basic.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:32.656348 | import os
import torch
from models import TimeMixer
class Exp_Basic(object):
def __init__(self, args):
self.args = args
self.model_dict = {
'TimeMixer': TimeMixer,
}
self.device = self._acquire_device()
self.model = self._build_model().to(self.device)
def _... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | data_provider/uea.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:32.657804 | import os
import numpy as np
import pandas as pd
import torch
def collate_fn(data, max_len=None):
"""Build mini-batch tensors from a list of (X, mask) tuples. Mask input. Create
Args:
data: len(batch_size) list of tuples (X, y).
- X: torch tensor of shape (seq_length, feat_dim); variable s... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | data_provider/m4.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:32.658763 | # This source code is provided for the purposes of scientific reproducibility
# under the following limited license from Element AI Inc. The code is an
# implementation of the N-BEATS model (Oreshkin et al., N-BEATS: Neural basis
# expansion analysis for interpretable time series forecasting,
# https://arxiv.org/abs/19... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | exp/exp_classification.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:32.660729 | from torch.optim import lr_scheduler
from data_provider.data_factory import data_provider
from exp.exp_basic import Exp_Basic
from utils.tools import EarlyStopping, adjust_learning_rate, cal_accuracy
import torch
import torch.nn as nn
from torch import optim
import os
import time
import warnings
import numpy as np
imp... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | exp/exp_imputation.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:32.662066 |
from torch.optim import lr_scheduler
from data_provider.data_factory import data_provider
from exp.exp_basic import Exp_Basic
from utils.tools import EarlyStopping, adjust_learning_rate, visual
from utils.metrics import metric
import torch
import torch.nn as nn
from torch import optim
import os
import time
import war... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | data_provider/data_loader.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:32.665218 | import os
import numpy as np
import pandas as pd
import glob
import re
import torch
from sktime.datasets import load_from_tsfile_to_dataframe
from torch.utils.data import Dataset
from sklearn.preprocessing import StandardScaler
from utils.timefeatures import time_features
from data_provider.m4 import M4Dataset, M4Meta
... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | data_provider/data_factory.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:32.694627 | from data_provider.data_loader import Dataset_ETT_hour, Dataset_ETT_minute, Dataset_Custom, Dataset_M4, PSMSegLoader, \
MSLSegLoader, SMAPSegLoader, SMDSegLoader, SWATSegLoader, UEAloader, Dataset_PEMS, \
Dataset_Solar
from data_provider.uea import collate_fn
from torch.utils.data import DataLoader
data_dict =... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | layers/AutoCorrelation.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:33.458951 | import torch
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
import numpy as np
import math
from math import sqrt
import os
class AutoCorrelation(nn.Module):
"""
AutoCorrelation Mechanism with the following two phases:
(1) period-based dependencies discovery
(2) t... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | layers/FourierCorrelation.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:33.461314 | import numpy as np
import torch
import torch.nn as nn
def get_frequency_modes(seq_len, modes=64, mode_select_method='random'):
"""
get modes on frequency domain:
'random' means sampling randomly;
'else' means sampling the lowest modes;
"""
modes = min(modes, seq_len // 2)
if mode_select_me... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | layers/StandardNorm.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:33.462459 | import torch
import torch.nn as nn
class Normalize(nn.Module):
def __init__(self, num_features: int, eps=1e-5, affine=False, subtract_last=False, non_norm=False):
"""
:param num_features: the number of features or channels
:param eps: a value added for numerical stability
:param aff... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | layers/Embed.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:33.463417 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils import weight_norm
import math
class PositionalEmbedding(nn.Module):
def __init__(self, d_model, max_len=5000):
super(PositionalEmbedding, self).__init__()
# Compute the positional encodings once in log space.
... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | layers/Autoformer_EncDec.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:33.464757 | import torch
import torch.nn as nn
import torch.nn.functional as F
class my_Layernorm(nn.Module):
"""
Special designed layernorm for the seasonal part
"""
def __init__(self, channels):
super(my_Layernorm, self).__init__()
self.layernorm = nn.LayerNorm(channels)
def forward(self, ... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | exp/exp_long_term_forecasting.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:33.465915 | from torch.optim import lr_scheduler
from data_provider.data_factory import data_provider
from exp.exp_basic import Exp_Basic
from utils.tools import EarlyStopping, adjust_learning_rate, visual, save_to_csv, visual_weights
from utils.metrics import metric
import torch
import torch.nn as nn
from torch import optim
impo... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | exp/exp_short_term_forecasting.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:33.467064 | from torch.optim import lr_scheduler
from data_provider.data_factory import data_provider
from data_provider.m4 import M4Meta
from exp.exp_basic import Exp_Basic
from utils.tools import EarlyStopping, adjust_learning_rate, visual, save_to_csv
from utils.losses import mape_loss, mase_loss, smape_loss
from utils.m4_summ... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | layers/SelfAttention_Family.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:33.468584 | import torch
import torch.nn as nn
import numpy as np
from math import sqrt
from einops import rearrange, repeat
from utils.masking import TriangularCausalMask, ProbMask
from reformer_pytorch import LSHSelfAttention
class DSAttention(nn.Module):
'''De-stationary Attention'''
def __init__(self, mask_flag=Tr... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | layers/DWT_Decomposition.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:33.469641 | import torch
import torch.nn as nn
import pywt
import numpy as np
import torch.nn.functional as F
from torch.autograd import Function
class Decomposition(nn.Module):
def __init__(self,
input_length=[],
pred_length=[],
wavelet_name=[],
... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | layers/Conv_Blocks.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:33.749784 | import torch
import torch.nn as nn
class Inception_Block_V1(nn.Module):
def __init__(self, in_channels, out_channels, stride=1, num_kernels=6, init_weight=True):
super(Inception_Block_V1, self).__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.num_kern... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | layers/Transformer_EncDec.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:34.025211 | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvLayer(nn.Module):
def __init__(self, c_in):
super(ConvLayer, self).__init__()
self.downConv = nn.Conv1d(in_channels=c_in,
out_channels=c_in,
kernel_size=... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | models/TimeMixer.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:34.060926 | import torch
import torch.nn as nn
import torch.nn.functional as F
from layers.Autoformer_EncDec import series_decomp
from layers.Embed import DataEmbedding_wo_pos
from layers.StandardNorm import Normalize
class DFT_series_decomp(nn.Module):
"""
Series decomposition block
"""
def __init__(self, top_k=... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | utils/data_analysis.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:34.076420 | import numpy as np
from scipy.stats import entropy
def forecastabilty(ts):
"""Forecastability Measure.
Args:
ts: time series
Returns:
1 - the entropy of the fourier transformation of
time series / entropy of white noise
"""
ts = (ts - ts.min())/(ts.max()-ts.min()+0.1)
# fourier_ts = n... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | run.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:34.103684 | import argparse
import torch
from exp.exp_anomaly_detection import Exp_Anomaly_Detection
from exp.exp_classification import Exp_Classification
from exp.exp_imputation import Exp_Imputation
from exp.exp_long_term_forecasting import Exp_Long_Term_Forecast
from exp.exp_short_term_forecasting import Exp_Short_Term_Forecas... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | utils/losses.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:34.109925 | # This source code is provided for the purposes of scientific reproducibility
# under the following limited license from Element AI Inc. The code is an
# implementation of the N-BEATS model (Oreshkin et al., N-BEATS: Neural basis
# expansion analysis for interpretable time series forecasting,
# https://arxiv.org/abs/19... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | utils/m4_summary.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:34.130584 | # This source code is provided for the purposes of scientific reproducibility
# under the following limited license from Element AI Inc. The code is an
# implementation of the N-BEATS model (Oreshkin et al., N-BEATS: Neural basis
# expansion analysis for interpretable time series forecasting,
# https://arxiv.org/abs/19... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | utils/masking.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:34.345360 | import torch
class TriangularCausalMask():
def __init__(self, B, L, device="cpu"):
mask_shape = [B, 1, L, L]
with torch.no_grad():
self._mask = torch.triu(torch.ones(mask_shape, dtype=torch.bool), diagonal=1).to(device)
@property
def mask(self):
return self._mask
cla... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | utils/metrics.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:34.557840 | import numpy as np
def RSE(pred, true):
return np.sqrt(np.sum((true - pred) ** 2)) / np.sqrt(np.sum((true - true.mean()) ** 2))
def CORR(pred, true):
u = ((true - true.mean(0)) * (pred - pred.mean(0))).sum(0)
d = np.sqrt(((true - true.mean(0)) ** 2 * (pred - pred.mean(0)) ** 2).sum(0))
return (u / d... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | utils/tools.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:34.639108 | import numpy as np
import pandas as pd
import torch
import matplotlib.pyplot as plt
plt.switch_backend('agg')
def adjust_learning_rate(optimizer, scheduler, epoch, args, printout=True):
# lr = args.learning_rate * (0.2 ** (epoch // 2))
if args.lradj == 'type1':
lr_adjust = {epoch: args.learning_rate ... |
kwuking/TimeMixer | https://github.com/kwuking/TimeMixer | null | null | null | null | 1,922 | null | null | apache-2.0 | null | null | null | null | null | null | null | utils/timefeatures.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:34.639627 | from typing import List
import numpy as np
import pandas as pd
from pandas.tseries import offsets
from pandas.tseries.frequencies import to_offset
class TimeFeature:
def __init__(self):
pass
def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
pass
def __repr__(self):
retu... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | container/bert_batch/wsgi.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:37.769897 | import predictor as myapp
# This is just a simple wrapper for gunicorn to find your app.
# If you want to change the algorithm file, simply change "predictor" above to the
# new file.
app = myapp.app |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | container_ner/bert/download_pretrained_models.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:37.771169 | import argparse
from pathlib import Path
from tqdm import tqdm
import requests
import urllib3
PRETRAINED_VOCAB_FILES_MAP = {
# BERT
"bert-base-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-uncased-vocab.txt",
"bert-large-uncased": "https://s3.amazonaws.com/models.huggingface.co/b... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | container_ner/bert/wsgi.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:37.772352 | import predictor as myapp
# This is just a simple wrapper for gunicorn to find your app.
# If you want to change the algorithm file, simply change "predictor" above to the
# new file.
app = myapp.app |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | container_lm/bert/wsgi.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:37.855675 | import predictor as myapp
# This is just a simple wrapper for gunicorn to find your app.
# If you want to change the algorithm file, simply change "predictor" above to the
# new file.
app = myapp.app |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | container/bert/wsgi.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:37.857120 | import predictor as myapp
# This is just a simple wrapper for gunicorn to find your app.
# If you want to change the algorithm file, simply change "predictor" above to the
# new file.
app = myapp.app |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | container/bert/download_pretrained_models.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:37.872754 | import argparse
from pathlib import Path
from tqdm import tqdm
import requests
import urllib3
from transformers import AutoModel, AutoTokenizer
def download_pretrained_files(model_name, location):
try:
model_path = model_name.replace("/", ":")
model = AutoModel.from_pretrained(model_name)
... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | container_lm/bert/download_pretrained_models.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:37.873289 | import argparse
from pathlib import Path
from tqdm import tqdm
import requests
import urllib3
PRETRAINED_VOCAB_FILES_MAP = {
# BERT
"bert-base-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-uncased-vocab.txt",
"bert-large-uncased": "https://s3.amazonaws.com/models.huggingface.co/b... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | container_ner/bert/predictor.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:37.874672 | import os
import json
import pickle
import sys
import signal
import traceback
import re
import flask
import torch
from fast_bert.prediction_ner import BertNERPredictor
from fast_bert.utils.spellcheck import BingSpellCheck
from pathlib import Path
import warnings
warnings.filterwarnings("ignore", message="numpy.dty... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | container/bert/predictor.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:37.876144 | import os
import io
import json
import pickle
import sys
import signal
import traceback
import re
import flask
import pandas as pd
import torch
from collections import OrderedDict
from fast_bert.prediction import BertClassificationPredictor
from fast_bert.utils.spellcheck import BingSpellCheck
from pathlib import Pat... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | container/bert_batch/predictor.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:37.893715 | import os
import io
import json
import pickle
import sys
import signal
import traceback
import re
import flask
import pandas as pd
import torch
from collections import OrderedDict
from fast_bert.prediction import BertClassificationPredictor
from fast_bert.utils.spellcheck import BingSpellCheck
from pathlib import Pat... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | container_t5/t5/download_pretrained_models.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:38.459694 | import argparse
from pathlib import Path
from tqdm import tqdm
import requests
import urllib3
PRETRAINED_VOCAB_FILES_MAP = {
# BERT
"bert-base-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-uncased-vocab.txt",
"bert-large-uncased": "https://s3.amazonaws.com/models.huggingface.co/b... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/bert_layers.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:38.481830 | import torch
from torch import nn
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(BertLayerNorm, self).__init__()
self.weight = nn.Parameter(torch.ones(hidden_siz... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:38.484123 | from .modeling import BertForMultiLabelSequenceClassification
# from .data import BertDataBunch, InputExample, InputFeatures, MultiLabelTextProcessor, convert_examples_to_features
from .data_cls import (
BertDataBunch,
InputExample,
InputFeatures,
MultiLabelTextProcessor,
convert_examples_to_featur... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | container_t5/t5/predictor.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:38.486143 | import os
import json
import pickle
import sys
import signal
import traceback
import re
import flask
import torch
from fast_bert.prediction import BertClassificationPredictor
from fast_bert.utils.spellcheck import BingSpellCheck
from pathlib import Path
import warnings
warnings.filterwarnings("ignore", message="nu... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/data_cls.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:38.487301 | import pandas as pd
import os
import torch
from pathlib import Path
import pickle
import logging
import shutil
from torch.utils.data import (
Dataset,
TensorDataset,
DataLoader,
RandomSampler,
SequentialSampler,
)
from torch.utils.data.distributed import DistributedSampler
from transformers impor... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | container_t5/t5/wsgi.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:38.488481 | import predictor as myapp
# This is just a simple wrapper for gunicorn to find your app.
# If you want to change the algorithm file, simply change "predictor" above to the
# new file.
app = myapp.app |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/data_abs.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:38.532694 | import re
import html
import logging
import pandas as pd
import os
import random
import torch
from pathlib import Path
import pickle
import shutil
from collections import deque, namedtuple
from torch.utils.data import Dataset, DataLoader, SequentialSampler
from tokenizers import BertWordPieceTokenizer
from transformers... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/data_lm.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:38.584961 | from sklearn.model_selection import train_test_split
import re
import html
import logging
import pandas as pd
import os
import random
import torch
from pathlib import Path
import pickle
import shutil
import itertools
import more_itertools
from torch.utils.data import (
TensorDataset,
DataLoader,
RandomSam... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/data.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:38.586169 | import pandas as pd
import os
import torch
from pathlib import Path
import pickle
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from torch.utils.data.distributed import DistributedSampler
from transformers import (WEIGHTS_NAME, BertConfig,
B... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/data_ner.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:38.638563 | from sklearn.model_selection import train_test_split
import json
import logging
import os
import torch
from torch import nn
from dataclasses import dataclass
from enum import Enum
from typing import List, Optional, Union
from pathlib import Path
import pickle
from filelock import FileLock
import re
import shutil
from... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/data_qa.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:39.084336 | import json
import os
import torch
from pathlib import Path
import pickle
import logging
import collections
from io import open
import shutil
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from torch.utils.data.distributed import DistributedSampler
from transformers.tokenizat... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/learner_lm.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:39.121428 | import os
import torch
from packaging import version
from pathlib import Path
import numpy as np
from fastprogress.fastprogress import master_bar, progress_bar
from tensorboardX import SummaryWriter
from .learner_util import Learner
from .data_lm import BertLMDataBunch
from transformers import (
WEIGHTS_NAME,
... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/learner_cls.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:39.122617 | import os
import copy
import logging
from packaging import version
from .data_cls import BertDataBunch
from tqdm.autonotebook import tqdm
import matplotlib.pyplot as plt
from .learner_util import Learner
from torch import nn
from typing import List, Optional
from .modeling import (
BertForMultiLabelSequenceClassif... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/learner_abs.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:39.151047 | import os
from .data_abs import BertAbsDataBunch
from .learner_util import Learner
from torch import nn
from typing import List
import torch
from box import Box
from tokenizers import BertWordPieceTokenizer
from .summarisation import BertAbs, build_predictor
from .summarisation import BertAbsConfig
from fastprogress.f... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/learner_ner.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:39.152554 | import os
import logging
import torch
import numpy as np
from .data_ner import BertNERDataBunch
from torch import nn
from seqeval.metrics import f1_score, precision_score, recall_score
from typing import Dict, List, Optional, Tuple
from .learner_util import Learner
from transformers import (
AutoConfig,
AutoMo... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/learner_cls copy.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:39.161629 | import os
import copy
import logging
from packaging import version
from .data_cls import BertDataBunch, InputExample, InputFeatures
from tqdm.autonotebook import tqdm
import matplotlib.pyplot as plt
from .learner_util import Learner
from torch import nn
from typing import List, Optional
from .modeling import (
Ber... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/metrics.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:39.163405 | from sklearn.metrics import (
roc_curve,
auc,
hamming_loss,
accuracy_score,
confusion_matrix as sklearn_confusion_matrix,
)
import numpy as np
from torch import Tensor
import pdb
import logging
logger = logging.getLogger()
CLASSIFICATION_THRESHOLD: float = 0.5 # Best keep it in [0.0, 1.0] range
... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/learner_qa.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:39.168000 | import os
import torch
import pandas as pd
import numpy as np
from pathlib import Path
import collections
import math
from io import open
import json
from .data_qa import BertQADataBunch
from .learner_util import Learner
from fastprogress.fastprogress import master_bar, progress_bar
from tensorboardX import SummaryWr... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/learner_util.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:39.227100 | import torch
from pathlib import Path
import logging
from transformers import (
AdamW,
get_constant_schedule,
get_constant_schedule_with_warmup,
get_linear_schedule_with_warmup,
get_cosine_schedule_with_warmup,
get_cosine_with_hard_restarts_schedule_with_warmup,
)
from pytorch_lamb import Lamb... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/onnx_helper.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:41.992332 | from onnxruntime import (
GraphOptimizationLevel,
InferenceSession,
SessionOptions,
get_all_providers,
)
import logging
import numpy as np
from pathlib import Path
logger = logging.getLogger()
def create_model_for_provider(model_path: str, provider: str) -> InferenceSession:
assert (
pr... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/modeling.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:43.016213 | from transformers import (
BertForSequenceClassification,
BertModel,
BertConfig,
XLNetForSequenceClassification,
RobertaModel,
RobertaConfig,
BertPreTrainedModel,
RobertaForSequenceClassification,
DistilBertForSequenceClassification,
CamembertForSequenceClassification,
Albert... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/utils_squad_evaluate.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:44.466795 | """ Official evaluation script for SQuAD version 2.0.
Modified by XLNet authors to update `find_best_threshold` scripts for SQuAD V2.0
In addition to basic functionality, we also compute additional statistics and
plot precision-recall curves if an additional na_prob.json file is provided.
This file is expected to m... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | setup.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:44.623716 | import sys
from io import open
from setuptools import setup, find_packages
import subprocess
with open("requirements.txt") as f:
install_requires = f.read().strip().split("\n")
# get version from VERSION.txt
with open("VERSION.txt") as f:
version = f.read().strip()
setup(
name="fast_bert",
# get ve... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/prediction.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:44.736888 | import torch
from pathlib import Path
from .onnx_helper import load_model
from transformers import AutoTokenizer
import numpy as np
import warnings
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
class BertClassificationP... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/optimization.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:44.738058 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/prediction_ner.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:44.820597 | import torch
from pathlib import Path
from .onnx_helper import load_model
from .learner_ner import group_entities
from .data_ner import get_labels
from transformers import AutoTokenizer
import numpy as np
import warnings
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
warnings.filterwarnings(... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/utils/spellcheck.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:44.821087 | import json
import requests
class BingSpellCheck(object):
def __init__(self, key):
self.api_key = key
self.endpoint = "https://api.cognitive.microsoft.com/bing/v7.0/SpellCheck"
def spell_check(self, text, mode='spell'):
data = {'text': text}
params = {
'mkt': 'en-... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/summarisation/configuration_bertabs.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:44.821628 | # coding=utf-8
# Copyright 2019 The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... |
appvision-ai/fast-bert | https://github.com/appvision-ai/fast-bert | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | fast_bert/summarisation/modeling_bertabs.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:44.926243 | # MIT License
# Copyright (c) 2019 Yang Liu and the HuggingFace team
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, c... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | inference_t2i.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:47.617026 | # coding=utf-8
# Copyright 2024 NUS Show Lab.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | llava/llava/mm_utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:47.628779 | from PIL import Image
from io import BytesIO
import base64
import torch
import math
import ast
from transformers import StoppingCriteria
from .constants import IMAGE_TOKEN_INDEX
def select_best_resolution(original_size, possible_resolutions):
"""
Selects the best resolution from a list of possible resolution... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | llava/llava/constants.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:47.631308 | CONTROLLER_HEART_BEAT_EXPIRATION = 30
WORKER_HEART_BEAT_INTERVAL = 15
LOGDIR = "."
# Model Constants
IGNORE_INDEX = -100
IMAGE_TOKEN_INDEX = -200
DEFAULT_IMAGE_TOKEN = "<image>"
DEFAULT_IMAGE_PATCH_TOKEN = "<im_patch>"
DEFAULT_IM_START_TOKEN = "<im_start>"
DEFAULT_IM_END_TOKEN = "<im_end>"
IMAGE_PLACEHOLDER = "<image... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | llava/llava_data_vq_unified.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:47.647566 | import copy
import json
import os
from functools import partial
import torch
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
from PIL import Image
from torch.utils.data import Dataset
from torch.utils.data.distributed import DistributedSampler
from training.utils import image_transform
from llava.lla... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | llava/llava/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:47.649424 | import datetime
import logging
import logging.handlers
import os
import sys
import requests
from .constants import LOGDIR
server_error_msg = "**NETWORK ERROR DUE TO HIGH TRAFFIC. PLEASE REGENERATE OR REFRESH THIS PAGE.**"
moderation_msg = "YOUR INPUT VIOLATES OUR CONTENT MODERATION GUIDELINES. PLEASE TRY AGAIN."
ha... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | inference_mmu.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:47.652415 | # coding=utf-8
# Copyright 2024 NUS Show Lab.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | llava/llava_instruct_data.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:47.657901 | import copy
import json
import os
from functools import partial
import torch
from PIL import ImageFile
from transformers import CLIPImageProcessor
ImageFile.LOAD_TRUNCATED_IMAGES = True
from PIL import Image
from torch.utils.data import Dataset
from torch.utils.data.distributed import DistributedSampler
from llava.l... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | llava/llava/conversation.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:47.659336 | # Modified from LLaVA: https://github.com/haotian-liu/LLaVA.git
import dataclasses
from enum import auto, Enum
from typing import List, Tuple
import base64
from io import BytesIO
from PIL import Image
class SeparatorStyle(Enum):
"""Different separator style."""
SINGLE = auto()
TWO = auto()
MPT = auto(... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | llava/llava_pretrain_data.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:48.256665 | import copy
import json
import os
from functools import partial
import torch
from PIL import Image
from llava.llava import conversation as conversation_lib
from torch.utils.data import Dataset
from torch.utils.data.distributed import DistributedSampler
from transformers import CLIPImageProcessor
DEFAULT_IMAGE_TOKEN =... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | models/clip_encoder.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:48.257778 | import torch
import torch.nn as nn
from transformers import CLIPVisionModel, CLIPImageProcessor, CLIPVisionConfig
class CLIPVisionTower(nn.Module):
def __init__(self, vision_tower):
super().__init__()
self.is_loaded = False
self.vision_tower_name = vision_tower
self.select_layer ... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | models/misc.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:48.265202 | from omegaconf import OmegaConf
import torch
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
NamedTuple,
NewType,
Optional,
Sized,
Tuple,
Type,
TypeVar,
Union,
)
try:
from typing import Literal
except ImportError:
from typing_extensions import Litera... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | models/modeling_magvitv2.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:48.266372 | from dataclasses import dataclass, field
import numpy as np
import torch
import torch.nn as nn
from .common_modules import *
from .modeling_utils import ConfigMixin, ModelMixin, register_to_config
from .misc import *
import math
class Updateable:
def do_update_step(
self, epoch: int, global_step: int, ... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | models/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:48.281071 | from .modeling_showo import Showo
from .modeling_magvitv2 import VQGANEncoder, VQGANDecoder, LFQuantizer, MAGVITv2
from .sampling import *
from .clip_encoder import CLIPVisionTower |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | models/logging.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:48.308150 | # coding=utf-8
# Copyright 2023 Optuna, Hugging Face
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | models/modeling_showo.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:48.309871 | # coding=utf-8
# Copyright 2024 NUS Show Lab, HuggingFace.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | models/lr_schedulers.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:48.338920 | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | models/common_modules.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:48.341109 | """
Modified from https://github.com/CompVis/taming-transformers/blob/master/taming/modules/diffusionmodules/model.py#L34
"""
import math
from typing import Tuple, Union
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch ... |
showlab/Show-o | https://github.com/showlab/Show-o | null | null | null | null | 1,921 | null | null | apache-2.0 | null | null | null | null | null | null | null | models/modeling_utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:47:48.362860 | # coding=utf-8
# Copyright 2024 The HuggingFace Inc. team.
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.