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
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/backends/torch.py
null
null
null
null
null
null
Python
2026-05-04T01:35:21.313628
"""Required functions for optimized contractions of numpy arrays using pytorch.""" from opt_einsum.helpers import has_array_interface from opt_einsum.parser import convert_to_valid_einsum_chars from opt_einsum.sharing import to_backend_cache_wrap __all__ = [ "transpose", "einsum", "tensordot", "to_tor...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/backends/dispatch.py
null
null
null
null
null
null
Python
2026-05-04T01:35:21.316285
"""Handles dispatching array operations to the correct backend library, as well as converting arrays to backend formats and then potentially storing them as constants. """ import importlib from typing import Any from opt_einsum.backends import cupy as _cupy from opt_einsum.backends import jax as _jax from opt_einsum....
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/backends/object_arrays.py
null
null
null
null
null
null
Python
2026-05-04T01:35:21.320574
"""Functions for performing contractions with array elements which are objects.""" import functools import operator from opt_einsum.typing import ArrayType def object_einsum(eq: str, *arrays: ArrayType) -> ArrayType: """A ``einsum`` implementation for ``numpy`` arrays with object dtype. The loop is performe...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/helpers.py
null
null
null
null
null
null
Python
2026-05-04T01:35:22.398074
"""Contains helper functions for opt_einsum testing scripts.""" from collections.abc import Collection, Iterable from typing import Any, overload from opt_einsum.typing import ArrayIndexType, ArrayType __all__ = ["compute_size_by_dict", "find_contraction", "flop_count"] _valid_chars = "abcdefghijklmopqABC" _sizes =...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/sharing.py
null
null
null
null
null
null
Python
2026-05-04T01:35:22.399862
"""A module for sharing intermediates between contractions. Copyright (c) 2018 Uber Technologies """ import contextlib import functools import numbers import threading from collections import Counter, defaultdict from collections import Counter as CounterType from collections.abc import Generator from typing import A...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/blas.py
null
null
null
null
null
null
Python
2026-05-04T01:35:22.401573
"""Determines if a contraction can use BLAS or not.""" from collections.abc import Sequence from opt_einsum.typing import ArrayIndexType __all__ = ["can_blas"] def can_blas( inputs: list[str], result: str, idx_removed: ArrayIndexType, shapes: Sequence[tuple[int]] | None = None, ) -> str | bool: ...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/parser.py
null
null
null
null
null
null
Python
2026-05-04T01:35:22.402506
"""A functionally equivalent parser of the numpy.einsum input parser.""" import itertools from collections.abc import Iterator, Sequence from typing import Any from opt_einsum.typing import ArrayType, TensorShapeType __all__ = [ "is_valid_einsum_char", "has_valid_einsum_chars_only", "get_symbol", "ge...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/contract.py
null
null
null
null
null
null
Python
2026-05-04T01:35:22.403873
"""Contains the primary optimization and contraction routines.""" from collections.abc import Collection, Iterable, Sequence from decimal import Decimal from functools import lru_cache from typing import Any, Literal, overload from opt_einsum import backends, blas, helpers, parser, paths, sharing from opt_einsum.typi...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/paths.py
null
null
null
null
null
null
Python
2026-05-04T01:35:22.405131
"""Contains the path technology behind opt_einsum in addition to several path helpers.""" import bisect import functools import heapq import itertools import operator import random import re from collections import Counter, defaultdict from collections import Counter as CounterType from collections.abc import Callable...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/path_random.py
null
null
null
null
null
null
Python
2026-05-04T01:35:24.034550
"""Support for random optimizers, including the random-greedy path.""" import functools import heapq import math import time from collections import deque from collections.abc import Generator, Iterable from decimal import Decimal from random import choices as random_choices from random import seed as random_seed from...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/testing.py
null
null
null
null
null
null
Python
2026-05-04T01:35:24.074481
"""Testing routines for opt_einsum.""" import random from typing import Any, Literal, overload import pytest from opt_einsum.parser import get_symbol from opt_einsum.typing import ArrayType, PathType, TensorShapeType _no_collision_chars = "".join(chr(i) for i in range(7000, 7007)) _valid_chars = "abcdefghijklmnopqA...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/tests/test_blas.py
null
null
null
null
null
null
Python
2026-05-04T01:35:24.132853
""" Tests the BLAS capability for the opt_einsum module. """ from typing import Any import pytest from opt_einsum import blas, contract blas_tests = [ # DOT ((["k", "k"], "", set("k")), "DOT"), # DDOT ((["ijk", "ijk"], "", set("ijk")), "DOT"), # DDOT # GEMV? # GEMM ((["ij", "jk"], "ik", se...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/tests/test_sharing.py
null
null
null
null
null
null
Python
2026-05-04T01:35:24.147856
import itertools import weakref from collections import Counter from typing import Any import pytest from opt_einsum import contract, contract_expression, contract_path, get_symbol, shared_intermediates from opt_einsum.backends import to_cupy, to_torch from opt_einsum.contract import _einsum from opt_einsum.parser im...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/tests/test_parser.py
null
null
null
null
null
null
Python
2026-05-04T01:35:24.187608
""" Directly tests various parser utility functions. """ from typing import Any import pytest from opt_einsum.parser import get_shape, get_symbol, parse_einsum_input from opt_einsum.testing import build_arrays_from_tuples def test_get_symbol() -> None: assert get_symbol(2) == "c" assert get_symbol(200000) ...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/tests/test_edge_cases.py
null
null
null
null
null
null
Python
2026-05-04T01:35:24.226673
""" Tets a series of opt_einsum contraction paths to ensure the results are the same for different paths """ from typing import Any import pytest from opt_einsum import contract, contract_expression, contract_path from opt_einsum.typing import PathType # NumPy is required for the majority of this file np = pytest.i...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/tests/test_contract.py
null
null
null
null
null
null
Python
2026-05-04T01:35:24.256418
""" Tets a series of opt_einsum contraction paths to ensure the results are the same for different paths """ from typing import Any import pytest from opt_einsum import contract, contract_expression, contract_path from opt_einsum.paths import _PATH_OPTIONS, linear_to_ssa, ssa_to_linear from opt_einsum.testing import...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/tests/test_backends.py
null
null
null
null
null
null
Python
2026-05-04T01:35:24.526721
import pytest from opt_einsum import backends, contract, contract_expression, sharing from opt_einsum.contract import ArrayShaped, infer_backend, parse_backend from opt_einsum.testing import build_views try: # needed so tensorflow doesn't allocate all gpu mem try: from tensorflow import ConfigProto #...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/typing.py
null
null
null
null
null
null
Python
2026-05-04T01:35:24.587910
"""Types used in the opt_einsum package.""" from collections import namedtuple from collections.abc import Callable, Collection from typing import Any, Literal TensorShapeType = tuple[int, ...] PathType = Collection[TensorShapeType] ArrayType = Any ArrayIndexType = frozenset[str] ArrayShaped = namedtuple("ArrayShap...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
scripts/compare_random_paths.py
null
null
null
null
null
null
Python
2026-05-04T01:35:24.659235
import resource import timeit from typing import Literal import numpy as np import pandas as pd import opt_einsum as oe rsrc = resource.RLIMIT_DATA limit = int(1e9) resource.setrlimit(rsrc, (limit, limit)) pd.set_option("display.width", 200) opt_path: Literal["optimal"] = "optimal" # Number of dimensions max_dims...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/tests/test_input.py
null
null
null
null
null
null
Python
2026-05-04T01:35:28.267317
""" Tests the input parsing for opt_einsum. Duplicates the np.einsum input tests. """ from typing import Any import pytest from opt_einsum import contract, contract_path from opt_einsum.testing import build_views np = pytest.importorskip("numpy") def test_type_errors() -> None: # subscripts must be a string ...
dgasmith/opt_einsum
https://github.com/dgasmith/opt_einsum
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
opt_einsum/tests/test_paths.py
null
null
null
null
null
null
Python
2026-05-04T01:35:28.277074
""" Tests the accuracy of the opt_einsum paths in addition to unit tests for the various path helper functions. """ import itertools from concurrent.futures import ProcessPoolExecutor from typing import Any import pytest import opt_einsum as oe from opt_einsum.testing import build_shapes, rand_equation from opt_eins...
bootmortis/iran-hosted-domains
https://github.com/bootmortis/iran-hosted-domains
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
src/create_config.py
null
null
null
null
null
null
Python
2026-05-04T01:35:30.449237
import json from typing import Iterable import constants as consts import utils def shadowrocket(bypass_domains: Iterable[str], ads_domains: Iterable[str]): config = ( "#Shadowrocket\n" "[General]\n" "fallback-dns-server = \n" "private-ip-answer = false\n" "bypass-system =...
bootmortis/iran-hosted-domains
https://github.com/bootmortis/iran-hosted-domains
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
src/main.py
null
null
null
null
null
null
Python
2026-05-04T01:35:30.459582
import os import re from functools import reduce from typing import Iterable import constants as consts import create_config import get_domians import utils from data.custom_domains import custom_domains def collect_and_clean_domains(*domain_set: Iterable[Iterable[str]]) -> Iterable[str]: domains = reduce(lambda...
bootmortis/iran-hosted-domains
https://github.com/bootmortis/iran-hosted-domains
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
src/utils.py
null
null
null
null
null
null
Python
2026-05-04T01:35:30.465944
import os import re import tempfile import urllib.request import zipfile import requests import tldextract URL_REGEX = re.compile( r"^" r"(?:https?://)?" # user:pass authentication r"(?:\S+(?::\S*)?@)?" r"(" # IP address exclusion # private & local networks r"(?!(?:10|127)(?:\.\d{1,3})...
bootmortis/iran-hosted-domains
https://github.com/bootmortis/iran-hosted-domains
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
src/constants.py
null
null
null
null
null
null
Python
2026-05-04T01:35:30.466487
# https://eservices.ito.gov.ir/page/iplist g2b_gov_url = "https://raw.githubusercontent.com/bootmortis/ito-gov-mirror/main/out/domains.csv" ads_url = "https://raw.githubusercontent.com/nimasaj/uBOPa/master/uBOPa_Pihole.txt" v2fly_base_url = "https://raw.githubusercontent.com/v2fly/domain-list-community/master/data/" # ...
bootmortis/iran-hosted-domains
https://github.com/bootmortis/iran-hosted-domains
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
src/data/custom_domains.py
null
null
null
null
null
null
Python
2026-05-04T01:35:30.472392
custom_domains = { "proxy": [ "animelist.ir", "gamepass.ir", ], "direct": [ "2agoo.com", "403.online", "aanidarman.com", "abankapp.ir", "abianpharmed.com", "abris.cloud", "actoverco.com", "adaklock.com", "admentor.net", ...
bootmortis/iran-hosted-domains
https://github.com/bootmortis/iran-hosted-domains
null
null
null
null
980
null
null
mit
null
null
null
null
null
null
null
src/get_domians.py
null
null
null
null
null
null
Python
2026-05-04T01:35:30.479275
import re from typing import Iterable import requests import constants as consts import utils def g2b_ito_gov() -> Iterable[str]: resp = requests.get(consts.g2b_gov_url) resp.raise_for_status() domains = resp.text domains = domains.splitlines()[1:] domains = (domain.split(',')[0] for domain in ...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/distributed/launch.py
null
null
null
null
null
null
Python
2026-05-04T01:35:33.474728
import os import torch from torch import distributed as dist from torch import multiprocessing as mp # import distributed as dist_fn import image_synthesis.distributed.distributed as dist_fn def find_free_port(): import socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(("", 0)) ...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/distributed/distributed.py
null
null
null
null
null
null
Python
2026-05-04T01:35:33.475714
import math import pickle import torch from torch import distributed as dist from torch.utils import data LOCAL_PROCESS_GROUP = None def is_primary(): return get_rank() == 0 def get_rank(): if not dist.is_available(): return 0 if not dist.is_initialized(): return 0 return dist.g...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/engine/clip_grad_norm.py
null
null
null
null
null
null
Python
2026-05-04T01:35:34.191410
from torch.nn.utils import clip_grad_norm_ class ClipGradNorm(object): def __init__(self, start_iteration=0, end_iteration=-1, # if negative, the norm will be always clipped max_norm=0.5): self.start_iteration = start_iteration self.end_iteratio...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/engine/ema.py
null
null
null
null
null
null
Python
2026-05-04T01:35:34.264698
import torch import copy class EMA(object): def __init__(self, model, decay=0.99, update_interval=1, device=torch.device('cpu')): self.decay = decay self.update_iterval = update_interval self.device = device se...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/engine/logger.py
null
null
null
null
null
null
Python
2026-05-04T01:35:34.755918
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import time import sys import torch from image_synthesis.utils.io import write_args, save_config_to_yaml from image_synthesis.distributed.distributed import is_primary import torch.utils.tensorboard a...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/engine/lr_scheduler.py
null
null
null
null
null
null
Python
2026-05-04T01:35:34.842021
import torch import math # from torch.optim import AdamW, Adam from torch._six import inf from torch.optim.optimizer import Optimizer from torch.optim.lr_scheduler import _LRScheduler, CosineAnnealingLR class ReduceLROnPlateauWithWarmup(object): """Reduce learning rate when a metric has stopped improving. Mo...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/engine/solver.py
null
null
null
null
null
null
Python
2026-05-04T01:35:35.330028
# ------------------------------------------ # VQ-Diffusion # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # written By Shuyang Gu # ------------------------------------------ import os import time import math import torch import threading import multiprocessing import copy from PIL import Im...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/build.py
null
null
null
null
null
null
Python
2026-05-04T01:35:35.406140
from image_synthesis.utils.misc import instantiate_from_config def build_model(config, args=None): return instantiate_from_config(config['model'])
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/codecs/base_codec.py
null
null
null
null
null
null
Python
2026-05-04T01:35:36.035381
import torch from torch import nn class BaseCodec(nn.Module): def get_tokens(self, x, **kwargs): """ Input: x: input data Return: indices: B x L, the codebook indices, where L is the length of flattened feature map size """ ...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/codecs/image_codec/ema_vqvae.py
null
null
null
null
null
null
Python
2026-05-04T01:35:36.035928
import torch import torch.nn as nn from omegaconf import OmegaConf import sys sys.path.append("..") # sys.path.append("../image_synthesis") import os import torchvision.transforms.functional as TF import PIL from image_synthesis.modeling.codecs.base_codec import BaseCodec from einops import rearrange import math import...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/codecs/image_codec/taming_gumbel_vqvae.py
null
null
null
null
null
null
Python
2026-05-04T01:35:36.751919
import torch import torch.nn as nn from omegaconf import OmegaConf import sys sys.path.append("..") # sys.path.append("../image_synthesis") from image_synthesis.utils.misc import instantiate_from_config from image_synthesis.taming.models.vqgan import GumbelVQ, VQModel from image_synthesis.taming.models.cond_transformer...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/codecs/image_codec/patch_vqgan.py
null
null
null
null
null
null
Python
2026-05-04T01:35:36.753000
from numpy.core.shape_base import block from numpy.lib import stride_tricks import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import random from torch.nn.modules.linear import Linear from image_synthesis.utils.misc import instantiate_from_config from image_synthesis.modeling.codecs....
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/codecs/text_codec/tokenize.py
null
null
null
null
null
null
Python
2026-05-04T01:35:37.309189
import torch import torch.nn as nn from image_synthesis.modeling.modules.clip.clip import tokenize from image_synthesis.modeling.codecs.base_codec import BaseCodec from image_synthesis.utils.misc import instantiate_from_config class Tokenize(BaseCodec): def __init__(self, context_length:int = 256, ...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/embeddings/base_embedding.py
null
null
null
null
null
null
Python
2026-05-04T01:35:37.318113
import torch from torch import nn class BaseEmbedding(nn.Module): def get_loss(self): return None def forward(self, **kwargs): raise NotImplementedError def train(self, mode=True): self.training = mode if self.trainable and mode: super().train() retur...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/embeddings/clip_text_embedding.py
null
null
null
null
null
null
Python
2026-05-04T01:35:37.962195
import torch import torch.nn as nn from image_synthesis.modeling.modules.clip import clip from image_synthesis.modeling.modules.clip import model as clip_model from .base_embedding import BaseEmbedding class CLIPTextEmbedding(BaseEmbedding): def __init__(self, clip_name='ViT-B/32', ...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/data/mscoco_dataset.py
null
null
null
null
null
null
Python
2026-05-04T01:35:37.975053
from torch.utils.data import Dataset import numpy as np import io from PIL import Image import os import json import random from image_synthesis.utils.misc import instantiate_from_config def load_img(filepath): img = Image.open(filepath).convert('RGB') return img class CocoDataset(Dataset): def __init__(s...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/embeddings/class_embedding.py
null
null
null
null
null
null
Python
2026-05-04T01:35:37.976254
import torch import torch.nn as nn from .base_embedding import BaseEmbedding class ClassEmbedding(BaseEmbedding): def __init__(self, num_embed=1000, embed_dim=512, identity=False, trainable=True, ): super().__init__() self...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/data/build.py
null
null
null
null
null
null
Python
2026-05-04T01:35:37.993812
import torch # from image_synthesis.data.base_dataset import ConcatDatasetWithIndex as ConcatDataset from torch.utils.data import ConcatDataset from image_synthesis.utils.misc import instantiate_from_config from image_synthesis.distributed.distributed import is_distributed def build_dataloader(config, args=None, retur...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/data/utils/comm.py
null
null
null
null
null
null
Python
2026-05-04T01:35:37.998949
""" This file contains primitives for multi-gpu communication. This is useful when doing distributed training. """ import pickle import torch import torch.distributed as dist # from diffdist.functional import all_gather as better_all_gather class Comm(object): def __init__(self, local_rank=0): self.loca...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/data/ffhq_dataset.py
null
null
null
null
null
null
Python
2026-05-04T01:35:37.999580
from torch.utils.data import Dataset import numpy as np import io from PIL import Image import os import json import random from image_synthesis.utils.misc import instantiate_from_config import torchvision.datasets as datasets class FFHQDataset(datasets.ImageFolder): def __init__(self, data_root, im_preprocessor_c...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/data/cub200_dataset.py
null
null
null
null
null
null
Python
2026-05-04T01:35:38.028940
from torch.utils.data import Dataset import numpy as np import io from PIL import Image import os import json import random from image_synthesis.utils.misc import instantiate_from_config from tqdm import tqdm import pickle def load_img(filepath): img = Image.open(filepath).convert('RGB') return img class Cub2...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/data/utils/image_preprocessor.py
null
null
null
null
null
null
Python
2026-05-04T01:35:38.029972
import albumentations import random import numpy as np from PIL import Image import cv2 from io import BytesIO from torchvision import transforms as trans class DalleTransformerPreprocessor(object): def __init__(self, size=256, phase='train', additional_targets=N...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/data/imagenet_dataset.py
null
null
null
null
null
null
Python
2026-05-04T01:35:38.060314
from torch.utils.data import Dataset import numpy as np import io from PIL import Image import os import json import random from image_synthesis.utils.misc import instantiate_from_config def load_img(filepath): img = Image.open(filepath).convert('RGB') return img class ImageNetDataset(Dataset): def __init...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/data/utils/manage.py
null
null
null
null
null
null
Python
2026-05-04T01:35:38.097360
from sys import stdout import zipfile import os.path as osp import lmdb import logging from PIL import Image import pickle import io import glob import os from pathlib import Path import time from threading import Thread from queue import Queue,Empty import subprocess def func_wrapper(func): def sub_func(queue,kwa...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/embeddings/dalle_mask_image_embedding.py
null
null
null
null
null
null
Python
2026-05-04T01:35:38.533606
import torch import torch.nn as nn from .base_embedding import BaseEmbedding class DalleMaskImageEmbedding(BaseEmbedding): def __init__(self, num_embed=8192, spatial_size=[32, 32], # height and with embed_dim=3968, trainable=True, ...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/models/conditional_dalle.py
null
null
null
null
null
null
Python
2026-05-04T01:35:38.535603
# ------------------------------------------ # VQ-Diffusion # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # written By Shuyang Gu # ------------------------------------------ import torch import math from torch import nn from image_synthesis.utils.misc import instantiate_from_config import t...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/modules/clip/clip_tokenizer.py
null
null
null
null
null
null
Python
2026-05-04T01:35:38.627411
import gzip import html import os from functools import lru_cache import ftfy import regex as re @lru_cache() def default_bpe(): return os.path.join(os.path.dirname(os.path.abspath(__file__)), "bpe_simple_vocab_16e6.txt.gz") @lru_cache() def bytes_to_unicode(): """ Returns list of utf-8 byte and a corr...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/modules/clip/model.py
null
null
null
null
null
null
Python
2026-05-04T01:35:38.628724
from collections import OrderedDict from typing import Tuple, Union import torch import torch.nn.functional as F from torch import nn class Bottleneck(nn.Module): expansion = 4 def __init__(self, inplanes, planes, stride=1): super().__init__() # all conv layers have stride 1. an avgpool is ...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/modules/clip/simple_tokenizer.py
null
null
null
null
null
null
Python
2026-05-04T01:35:38.649079
import gzip import html import os from functools import lru_cache import ftfy import regex as re @lru_cache() def default_bpe(): return os.path.join(os.path.dirname(os.path.abspath(__file__)), "bpe_simple_vocab_16e6.txt.gz") @lru_cache() def bytes_to_unicode(): """ Returns list of utf-8 byte and a corr...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/models/unconditional_dalle.py
null
null
null
null
null
null
Python
2026-05-04T01:35:38.661859
# ------------------------------------------ # VQ-Diffusion # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # written By Shuyang Gu # ------------------------------------------ import torch import math from torch import nn from image_synthesis.utils.misc import instantiate_from_config import t...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/modules/clip/clip.py
null
null
null
null
null
null
Python
2026-05-04T01:35:38.662470
import hashlib import os import urllib import warnings from typing import Union, List import torch from PIL import Image from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize from tqdm import tqdm from .model import build_model from .simple_tokenizer import SimpleTokenizer as _Tokenizer ...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/transformers/diffusion_transformer.py
null
null
null
null
null
null
Python
2026-05-04T01:35:38.712865
# ------------------------------------------ # VQ-Diffusion # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # written By Shuyang Gu # ------------------------------------------ import math import torch from torch import nn import torch.nn.functional as F from image_synthesis.utils.misc import...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/models/dalle.py
null
null
null
null
null
null
Python
2026-05-04T01:35:38.746765
# ------------------------------------------ # VQ-Diffusion # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # written By Shuyang Gu # ------------------------------------------ import torch import math from torch import nn from image_synthesis.utils.misc import instantiate_from_config import t...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/transformers/transformer_utils.py
null
null
null
null
null
null
Python
2026-05-04T01:35:39.430784
# ------------------------------------------ # VQ-Diffusion # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # written By Shuyang Gu # ------------------------------------------ import math import torch from torch import nn import torch.nn.functional as F from image_synthesis.utils...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/taming/modules/diffusionmodules/model.py
null
null
null
null
null
null
Python
2026-05-04T01:35:39.479964
# pytorch_diffusion + derived encoder decoder import math import torch import torch.nn as nn import numpy as np def get_timestep_embedding(timesteps, embedding_dim): """ This matches the implementation in Denoising Diffusion Probabilistic Models: From Fairseq. Build sinusoidal embeddings. This mat...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/taming/lr_scheduler.py
null
null
null
null
null
null
Python
2026-05-04T01:35:39.538204
import numpy as np class LambdaWarmUpCosineScheduler: """ note: use with a base_lr of 1.0 """ def __init__(self, warm_up_steps, lr_min, lr_max, lr_start, max_decay_steps, verbosity_interval=0): self.lr_warm_up_steps = warm_up_steps self.lr_start = lr_start self.lr_min = lr_min ...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/modeling/utils/misc.py
null
null
null
null
null
null
Python
2026-05-04T01:35:39.562123
from numpy.core.fromnumeric import resize from numpy.lib.function_base import kaiser from numpy.lib.npyio import save import torch import random import math from image_synthesis.distributed.distributed import all_reduce, get_world_size def logits_top_k(logits, filter_ratio = 0.5, minimum=1, pad_value=None): logits...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/taming/modules/losses/lpips.py
null
null
null
null
null
null
Python
2026-05-04T01:35:39.568706
"""Stripped version of https://github.com/richzhang/PerceptualSimilarity/tree/master/models""" import torch import torch.nn as nn from torchvision import models from collections import namedtuple from image_synthesis.taming.util import get_ckpt_path class LPIPS(nn.Module): # Learned perceptual metric def __...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/taming/modules/misc/coord.py
null
null
null
null
null
null
Python
2026-05-04T01:35:40.171879
import torch class CoordStage(object): def __init__(self, n_embed, down_factor): self.n_embed = n_embed self.down_factor = down_factor def eval(self): return self def encode(self, c): """fake vqmodel interface""" assert 0.0 <= c.min() and c.max() <= 1.0 b,c...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/taming/modules/losses/vqperceptual.py
null
null
null
null
null
null
Python
2026-05-04T01:35:40.173579
import torch import torch.nn as nn import torch.nn.functional as F from image_synthesis.taming.modules.losses.lpips import LPIPS from image_synthesis.taming.modules.discriminator.model import NLayerDiscriminator, weights_init class DummyLoss(nn.Module): def __init__(self): super().__init__() def adopt_...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/taming/modules/transformer/mingpt.py
null
null
null
null
null
null
Python
2026-05-04T01:35:40.174656
""" taken from: https://github.com/karpathy/minGPT/ GPT model: - the initial stem consists of a combination of token encoding and a positional encoding - the meat of it is a uniform sequence of Transformer blocks - each Transformer is a sequential combination of a 1-hidden-layer MLP block and a self-attention block...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/taming/models/cond_transformer.py
null
null
null
null
null
null
Python
2026-05-04T01:35:40.343200
import os, math import torch import torch.nn.functional as F import pytorch_lightning as pl from image_synthesis.utils.misc import instantiate_from_config from image_synthesis.taming.modules.util import SOSProvider def disabled_train(self, mode=True): """Overwrite model.train with this function to make sure trai...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/taming/modules/util.py
null
null
null
null
null
null
Python
2026-05-04T01:35:40.343719
import torch import torch.nn as nn def count_params(model): total_params = sum(p.numel() for p in model.parameters()) return total_params class ActNorm(nn.Module): def __init__(self, num_features, logdet=False, affine=True, allow_reverse_init=False): assert affine super(...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/taming/models/vqgan.py
null
null
null
null
null
null
Python
2026-05-04T01:35:40.352670
import torch import torch.nn.functional as F import pytorch_lightning as pl from image_synthesis.utils.misc import instantiate_from_config from image_synthesis.taming.modules.diffusionmodules.model import Encoder, Decoder from image_synthesis.taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer fr...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/taming/modules/transformer/permuter.py
null
null
null
null
null
null
Python
2026-05-04T01:35:40.723282
import torch import torch.nn as nn import numpy as np class AbstractPermuter(nn.Module): def __init__(self, *args, **kwargs): super().__init__() def forward(self, x, reverse=False): raise NotImplementedError class Identity(AbstractPermuter): def __init__(self): super().__init__()...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/taming/modules/discriminator/model.py
null
null
null
null
null
null
Python
2026-05-04T01:35:40.917775
import functools import torch.nn as nn from image_synthesis.taming.modules.util import ActNorm def weights_init(m): classname = m.__class__.__name__ if classname.find('Conv') != -1: nn.init.normal_(m.weight.data, 0.0, 0.02) elif classname.find('BatchNorm') != -1: nn.init.normal_(m.weight...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/taming/modules/vqvae/quantize.py
null
null
null
null
null
null
Python
2026-05-04T01:35:41.005304
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from torch import einsum from einops import rearrange class VectorQuantizer(nn.Module): """ see https://github.com/MishaLaskin/vqvae/blob/d761a999e2267766400dc646d82d3ac3657771d4/models/quantizer.py _____________________...
microsoft/VQ-Diffusion
https://github.com/microsoft/VQ-Diffusion
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
image_synthesis/taming/modules/losses/segmentation.py
null
null
null
null
null
null
Python
2026-05-04T01:35:44.498371
import torch.nn as nn import torch.nn.functional as F class BCELoss(nn.Module): def forward(self, prediction, target): loss = F.binary_cross_entropy_with_logits(prediction,target) return loss, {} class BCELossWithQuant(nn.Module): def __init__(self, codebook_weight=1.): super().__ini...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/api/core.py
null
null
null
null
null
null
Python
2026-05-04T01:35:46.665354
from cachebrowser.api.routes import routes class APIRequest(object): def __init__(self, route, params): self.route = route self.params = params def reply(self, response): raise NotImplementedError() class BaseAPIManager(object): def __init__(self): self.handlers = {} ...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/api/routes.py
null
null
null
null
null
null
Python
2026-05-04T01:35:46.672280
from cachebrowser.api.handlers.bootstrap import get_hosts, get_cdns, delete_host, add_host, add_cdn from cachebrowser.api.handlers.process import close, ping from cachebrowser.api.handlers.website import is_website_enabled, enable_website, disable_website routes = [ ('/close', close), ('/ping', ping), ('/h...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/api/handlers/process.py
null
null
null
null
null
null
Python
2026-05-04T01:35:46.675063
def close(context, request): import os import signal request.reply("OK") # sys.exit(0) os.kill(os.getpid(), signal.SIGINT) os._exit(0) def ping(context, request): request.reply("pong")
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/cli.py
null
null
null
null
null
null
Python
2026-05-04T01:35:46.683097
from functools import update_wrapper, partial import json import logging from cachebrowser.models import Host import click from cachebrowser.api.core import APIManager, APIRequest from cachebrowser.bootstrap import BootstrapError main_commands = ['hostcli', 'cdncli', 'bootstrap'] api = APIManager() logger = logging...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/bootstrap.py
null
null
null
null
null
null
Python
2026-05-04T01:35:46.688793
import random import yaml import logging from copy import deepcopy from yaml.scanner import ScannerError logger = logging.getLogger(__name__) class BootstrapSourceError(Exception): pass class BaseBootstrapSource(object): def lookup_host(self, hostname): pass def lookup_cdn(self, cdn_id): ...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/api/handlers/bootstrap.py
null
null
null
null
null
null
Python
2026-05-04T01:35:46.690030
from cachebrowser.models import Host, CDN def serialize_host(host): return { 'hostname': host.hostname, 'cdn': {'id': host.cdn.id, 'name': host.cdn.name} if host.cdn else None, 'ssl': host.ssl, } def serialize_cdn(cdn): return { 'id': cdn.id, 'name': cdn.name, ...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/api/handlers/website.py
null
null
null
null
null
null
Python
2026-05-04T01:35:46.718710
from cachebrowser.models import Website def enable_website(context, request): hostname = request.params.get('website', None) if hostname is None: return request.reply({'result': 'error', 'message': 'no website given'}) website, _ = Website.get_or_create(hostname=hostname) if not website.ena...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/main.py
null
null
null
null
null
null
Python
2026-05-04T01:35:47.719003
from __future__ import print_function, absolute_import import logging import logging.config import sys import inspect import os import click import mitmproxy import mitmproxy.controller from mitmproxy.proxy.server import ProxyServer from cachebrowser.bootstrap import Bootstrapper from cachebrowser.models import init...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/ipc.py
null
null
null
null
null
null
Python
2026-05-04T01:35:47.720930
import json from threading import Thread import traceback import uuid import logging import tornado.ioloop import tornado.web import tornado.websocket from cachebrowser.api.core import APIRequest logger = logging.getLogger(__name__) class IPCRouter(object): def __init__(self): self.clients = {} ...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/pipes/scrambler.py
null
null
null
null
null
null
Python
2026-05-04T01:35:47.721905
# cdn.jsdelivr.net import logging from time import time, sleep from threading import Thread, RLock from random import random, shuffle, choice from six.moves.urllib.parse import urlparse from mitmproxy.models import HTTPResponse from netlib.http import Headers from cachebrowser.pipes.base import FlowPipe from cachebro...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/pipes/sni.py
null
null
null
null
null
null
Python
2026-05-04T01:35:47.723031
from cachebrowser.pipes.base import FlowPipe SNI_EMPTY = "empty" SNI_FRONT = "font" SNI_ORIGINAL = "original" class SNIPipe(FlowPipe): def serverconnect(self, server_conn): host, cdn = getattr(server_conn, 'host', None), getattr(server_conn, 'cdn', None) if host and host.sni_policy: ...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/pipes/publisher.py
null
null
null
null
null
null
Python
2026-05-04T01:35:47.723896
from cachebrowser.pipes.base import FlowPipe from cachebrowser.util import get_flow_size class PublisherPipe(FlowPipe): def __init__(self, *args, **kwargs): super(PublisherPipe, self).__init__(*args, **kwargs) self._id_counter = 1 def start(self): self._id_counter = 1 def request...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/pipes/base.py
null
null
null
null
null
null
Python
2026-05-04T01:35:47.725058
from mitmproxy.script import Script, ScriptContext class FlowPipe(Script, ScriptContext): def __init__(self, context, master=None): self.context = context self.bootstrapper = self.context.bootstrapper self.settings = self.context.settings self.enabled = True self._master ...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/pipes/resolver.py
null
null
null
null
null
null
Python
2026-05-04T01:35:48.569902
from cachebrowser.bootstrap import BootstrapError from netlib.tcp import Address from cachebrowser.models import Host, DoesNotExist, CDN from cachebrowser.pipes.base import FlowPipe """ If the client initiates an HTTP connection, the 'request' hook will be called first and then 'serverconnect'. We can only upgrade th...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/settings/production.py
null
null
null
null
null
null
Python
2026-05-04T01:35:48.796217
import appdirs from cachebrowser.settings.base import APP_NAME, CacheBrowserSettings class ProductionSettings(CacheBrowserSettings): def set_defaults(self): self.host = "127.0.0.1" self.port = 8080 self.ipc_port = 9000 self.database = self.data_path('cachebrowser.db') self...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/settings/development.py
null
null
null
null
null
null
Python
2026-05-04T01:35:48.796819
from cachebrowser.settings.base import CacheBrowserSettings class DevelopmentSettings(CacheBrowserSettings): def set_defaults(self): self.host = "0.0.0.0" self.port = 8080 self.ipc_port = 9000 self.database = 'db.sqlite' self.bootstrap_sources = [ { ...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/settings/__init__.py
null
null
null
null
null
null
Python
2026-05-04T01:35:48.801852
from base import CacheBrowserSettings, SettingsValidationError from development import DevelopmentSettings from production import ProductionSettings __all__ = ['CacheBrowserSettings', 'DevelopmentSettings', 'ProductionSettings']
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/models.py
null
null
null
null
null
null
Python
2026-05-04T01:35:48.803046
import peewee import logging logger = logging.getLogger(__name__) db = peewee.SqliteDatabase('') class BaseModel(peewee.Model): pass class CDN(BaseModel): id = peewee.CharField(primary_key=True) name = peewee.CharField(null=True) edge_server = peewee.CharField(null=True) sni_policy = peewee.Cha...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/settings/base.py
null
null
null
null
null
null
Python
2026-05-04T01:35:48.803682
from functools import partial import os import logging import re import sys import yaml from cachebrowser.pipes.sni import SNI_EMPTY, SNI_ORIGINAL, SNI_FRONT APP_NAME = "CacheBrowser" logger = logging.getLogger(__name__) class InsufficientParametersException(Exception): pass class SettingsValidationError(Exce...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/proxy.py
null
null
null
null
null
null
Python
2026-05-04T01:35:48.808450
import logging import mitmproxy.controller import mitmproxy.proxy import mitmproxy.flow import mitmproxy.dump import mitmproxy.cmdline import mitmproxy.models import mitmproxy.protocol import mitmproxy as mproxy from mitmproxy.script import script from cachebrowser.models import Website from cachebrowser.pipes import ...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/util.py
null
null
null
null
null
null
Python
2026-05-04T01:35:48.811167
import os import importlib import inspect def get_flow_size(flow, ): """ (Not accurate) """ def get_size(r): s = len(r.content) for header in r.headers: s += len(header) s += len(r.headers[header]) # Colon s += 1 s += len(r.http_ve...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
cachebrowser/pipes/website_filter.py
null
null
null
null
null
null
Python
2026-05-04T01:35:48.920559
from urlparse import urlparse from cachebrowser.models import Website from cachebrowser.pipes.base import FlowPipe from cachebrowser.pipes import SKIP_PIPES class WebsiteFilterPipe(FlowPipe): def serverconnect(self, server_conn): if self._check_should_skip(server_conn=server_conn): return SKI...
CacheBrowser/cachebrowser
https://github.com/CacheBrowser/cachebrowser
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
setup.py
null
null
null
null
null
null
Python
2026-05-04T01:35:53.750256
from setuptools import setup, find_packages import os datafiles = [(root, [os.path.join(root, f) for f in files]) for root, dirs, files in os.walk('data')] setup( name='cachebrowser', description='A proxy-less censorship resistance tool', version='0.1.1', author='Hadi Zolfaghari', author_email='ha...
yaohungt/Multimodal-Transformer
https://github.com/yaohungt/Multimodal-Transformer
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
src/utils.py
null
null
null
null
null
null
Python
2026-05-04T01:35:55.710527
import torch import os from src.dataset import Multimodal_Datasets def get_data(args, dataset, split='train'): alignment = 'a' if args.aligned else 'na' data_path = os.path.join(args.data_path, dataset) + f'_{split}_{alignment}.dt' if not os.path.exists(data_path): print(f" - Creating new {split}...
yaohungt/Multimodal-Transformer
https://github.com/yaohungt/Multimodal-Transformer
null
null
null
null
979
null
null
mit
null
null
null
null
null
null
null
modules/position_embedding.py
null
null
null
null
null
null
Python
2026-05-04T01:35:55.714343
import math import torch import torch.nn as nn # Code adapted from the fairseq repo. def make_positions(tensor, padding_idx, left_pad): """Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbols are ignored, but it is necessary to specify whether ...