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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mandiant/speakeasy | https://github.com/mandiant/speakeasy | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | speakeasy/windows/regman.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:49.888788 | # Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
import base64
import fnmatch
import speakeasy.winenv.defs.registry.reg as regdefs
from speakeasy.errors import RegistryEmuError
HKEY_CLASSES_ROOT = 0x80000000
HKEY_CURRENT_USER = 0x80000001
HKEY_LOCAL_MACHINE = 0x80000002
HKEY_USERS = 0x80000003
class RegValu... |
mandiant/speakeasy | https://github.com/mandiant/speakeasy | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | speakeasy/windows/loaders.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:49.890675 | from __future__ import annotations
import ntpath
import os
from dataclasses import dataclass, field
from typing import Any, Protocol
import speakeasy.common as common
import speakeasy.winenv.arch as _arch
@dataclass
class ResourceEntry:
id: int | str
data_rva: int
size: int
type_id: int | str
en... |
mandiant/speakeasy | https://github.com/mandiant/speakeasy | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | speakeasy/windows/objman.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:49.891900 | # Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
import ntpath
import os
from typing import Any
import speakeasy.winenv.arch as _arch
import speakeasy.winenv.defs.nt.ddk as ddk
import speakeasy.winenv.defs.nt.ntoskrnl as ntoskrnl
import speakeasy.winenv.defs.windows.windows as windef
class Console:
"""
... |
mandiant/speakeasy | https://github.com/mandiant/speakeasy | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | speakeasy/windows/ioman.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:50.044020 | # Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
import speakeasy.windows.kernel_mods as km
import speakeasy.winenv.defs.nt.ddk as ddk
class IoManager:
"""
Directs IO requests to a module handler. For example, if a user mode application
sends an ioctl to a device this can be handled here.
"""
... |
mandiant/speakeasy | https://github.com/mandiant/speakeasy | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | speakeasy/windows/netman.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:50.078428 | # Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
import io
import os
from io import BytesIO
from typing import Any
from urllib.parse import urlparse
from speakeasy.errors import NetworkEmuError
def is_empty(bio):
if len(bio.getbuffer()) == bio.tell():
return True
return False
def normalize_... |
mandiant/speakeasy | https://github.com/mandiant/speakeasy | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | speakeasy/windows/sessman.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:50.298243 | # Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
from typing import Any
class GuiObject:
"""
Base class for all GUI objects
"""
curr_handle = 0x120
def __init__(self):
self.handle = self.get_handle()
def get_handle(self):
tmp = GuiObject.curr_handle
GuiObject... |
mandiant/speakeasy | https://github.com/mandiant/speakeasy | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | speakeasy/windows/win32.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:50.472541 | # Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
import hashlib
import ntpath
import os
import shlex
import speakeasy.common as common
import speakeasy.windows.objman as objman
import speakeasy.winenv.arch as _arch
from speakeasy.errors import Win32EmuError
from speakeasy.profiler import Run
from speakeasy.win... |
mandiant/speakeasy | https://github.com/mandiant/speakeasy | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | speakeasy/winenv/api/kernelmode/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:50.491361 | import os
__all__ = []
dirname = os.path.dirname(__file__)
for entry in os.listdir(dirname):
if os.path.isfile(os.path.join(dirname, entry)):
base, ext = os.path.splitext(entry)
if base != "__init__" and ext == ".py":
__all__.append(base)
del os
|
mandiant/speakeasy | https://github.com/mandiant/speakeasy | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | speakeasy/winenv/api/kernelmode/hal.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:50.513607 | # Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
import speakeasy.winenv.arch as _arch
import speakeasy.winenv.defs.nt.ntoskrnl as w
from speakeasy.winenv.api import api
class Hal(api.ApiHandler):
"""
Implements the hardware abstraction layer (hal.dll) that allows
Windows to interact with hardware... |
mandiant/speakeasy | https://github.com/mandiant/speakeasy | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | speakeasy/winenv/api/api.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:50.530151 | # Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
import logging
import speakeasy.windows.common as winemu
import speakeasy.winenv.arch as _arch
import speakeasy.winenv.defs.nt.ntoskrnl as ntos
from speakeasy.errors import ApiEmuError
from speakeasy.profiler import Run
from speakeasy.profiler_events import Trac... |
mandiant/speakeasy | https://github.com/mandiant/speakeasy | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | speakeasy/winenv/api/kernelmode/fwpkclnt.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:50.551257 | # Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
import uuid
import speakeasy.winenv.defs.nt.ddk as ddk
import speakeasy.winenv.defs.wfp.fwpmtypes as fwp
from .. import api
FWP_E_NOT_FOUND = 0x80320008
FWP_E_CALLOUT_NOT_FOUND = 0x80320001
FWP_E_FILTER_NOT_FOUND = 0x80320003
FWP_E_LAYER_NOT_FOUND = 0x80320004... |
mandiant/speakeasy | https://github.com/mandiant/speakeasy | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | speakeasy/winenv/api/kernelmode/ndis.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:50.641262 | # Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
import speakeasy.winenv.defs.ndis.ndis as ndis
import speakeasy.winenv.defs.nt.ddk as ddk
import speakeasy.winenv.defs.nt.ntoskrnl as nt
from .. import api
NDIS_STATUS_FAILURE = 0xC0000001
NDIS_STATUS_SUCCESS = 0x00000000
NDIS_STATUS_RESOURCES = 0xC000009A
cl... |
mandiant/speakeasy | https://github.com/mandiant/speakeasy | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | speakeasy/winenv/api/kernelmode/netio.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:50.643835 | # Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
from socket import inet_ntoa, ntohs
from typing import Any
import speakeasy.windows.netman as netman
import speakeasy.windows.objman as objman
import speakeasy.winenv.defs.nt.ddk as ddk
import speakeasy.winenv.defs.nt.ntoskrnl as nt
import speakeasy.winenv.defs.... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | app.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:54.956319 | from PIL import Image
import gradio as gr
from tools.imagenet_en_cn import IMAGENET_1K_CLASSES
from huggingface_hub import hf_hub_download
import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
torch.set_float32_matmul_precision('high')
setattr(torch.nn.Linear, 'reset_parameter... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/sample/sample_c2i.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:54.958013 | # Modified from:
# DiT: https://github.com/facebookresearch/DiT/blob/main/sample.py
import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
torch.set_float32_matmul_precision('high')
setattr(torch.nn.Linear, 'reset_parameters', lambda self: None)
setattr(torch.nn.LayerNorm, '... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/models/generate.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:54.959401 | # Modified from:
# gpt-fast: https://github.com/pytorch-labs/gpt-fast/blob/main/generate.py
# DiT: https://github.com/facebookresearch/DiT/blob/main/models.py
import torch
import torch.nn as nn
from torch.nn import functional as F
import torch._dynamo.config
import torch._inductor.config
import copy
# torch._i... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/models/gpt_hf.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:54.961980 | from autoregressive.models.gpt import ModelArgs, Transformer
from huggingface_hub import PyTorchModelHubMixin
class TransformerHF(Transformer, PyTorchModelHubMixin, repo_url="https://github.com/FoundationVision/LlamaGen", license="mit", tags=["llamagen", "text-to-image"]):
pass
#################################... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/sample/sample_t2i.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:54.963420 | import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
torch.set_float32_matmul_precision('high')
setattr(torch.nn.Linear, 'reset_parameters', lambda self: None) # disable default parameter init for faster speed
setattr(torch.nn.LayerNorm, 'reset_parameters', lambda self: N... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/sample/sample_t2i_ddp.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:54.964262 | import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
torch.set_float32_matmul_precision('high')
setattr(torch.nn.Linear, 'reset_parameters', lambda self: None) # disable default parameter init for faster speed
setattr(torch.nn.LayerNorm, 'reset_parameters', lambda self: N... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/serve/gpt_model.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:54.965521 | from dataclasses import dataclass
from typing import Optional, List
import torch
import torch.nn as nn
from vllm.model_executor.layers.layernorm import RMSNorm
from vllm.model_executor.layers.activation import SiluAndMul
from vllm.model_executor.sampling_metadata import SamplingMetadata
from vllm.sequence import Samp... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/serve/gpu_executor.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:54.966550 | from typing import Dict, List, Set, Tuple, Optional, Set
import argparse
from vllm.config import (CacheConfig, DeviceConfig, LoadConfig, LoRAConfig,
ModelConfig, ParallelConfig, SchedulerConfig,
SpeculativeConfig, VisionLanguageConfig)
from vllm.executor.executor_base ... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/models/gpt.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:55.037075 | # Modified from:
# VQGAN: https://github.com/CompVis/taming-transformers/blob/master/taming/modules/transformer/mingpt.py
# DiT: https://github.com/facebookresearch/DiT/blob/main/models.py
# nanoGPT: https://github.com/karpathy/nanoGPT/blob/master/model.py
# llama: https://github.com/facebookresea... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/serve/sample_c2i.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.013245 | import time
import argparse
import torch
from torchvision.utils import save_image
from tokenizer.tokenizer_image.vq_model import VQ_models
from autoregressive.serve.gpt_model import GPT_models
from autoregressive.serve.llm import LLM
from vllm import SamplingParams
def main(args):
# Setup PyTorch:
torch.man... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/train/extract_codes_c2i.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.014938 | # Modified from:
# fast-DiT: https://github.com/chuanyangjin/fast-DiT/blob/main/extract_features.py
import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import torch.distributed as dist
from torch.utils.data import DataLoader
from torch.utils.data.distributed import Distrib... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/serve/llm.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.020165 | # Modified from:
# vLLM: https://github.com/vllm-project/vllm/blob/main/vllm/entrypoints/llm.py
from typing import List, Optional, Union
import argparse
import torch
from tqdm import tqdm
from transformers import PreTrainedTokenizer, PreTrainedTokenizerFast
from vllm.engine.arg_utils import EngineArgs
# from vll... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/serve/worker.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.023807 | """A GPU worker class."""
import gc
import os
from typing import Any, Dict, List, Optional, Set, Tuple
import torch
import torch.distributed
from vllm.config import (CacheConfig, DeviceConfig, LoadConfig, LoRAConfig,
ModelConfig, ParallelConfig, SchedulerConfig,
Visio... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/serve/llm_engine.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.029553 | # Modified from:
# vLLM: https://github.com/vllm-project/vllm/blob/main/vllm/engine/llm_engine.py
import time
from typing import Iterable, List, Optional, Type, Union
import argparse
from transformers import GenerationConfig, PreTrainedTokenizer
import vllm
from vllm.config import (CacheConfig, DecodingConfig, D... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/serve/model_runner.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.047804 | import contextlib
import time
from enum import IntEnum
from typing import Dict, List, NamedTuple, Optional, Set, Tuple
import numpy as np
import torch
import torch.nn as nn
from vllm.attention import (AttentionMetadata, AttentionMetadataPerStage,
get_attn_backend)
from vllm.config import (... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/train/train_c2i_fsdp.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.590298 | # Modified from:
# Large-DiT: https://github.com/Alpha-VLLM/LLaMA2-Accessory/blob/main/Large-DiT-ImageNet/train.py
import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import torch.nn as nn
import torch.distributed as dist
from torch.utils.data import DataLoader
from torch.... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/train/train_t2i.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.604597 | # Modified from:
# fast-DiT: https://github.com/chuanyangjin/fast-DiT
# nanoGPT: https://github.com/karpathy/nanoGPT
import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
from tor... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | dataset/augmentation.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.620302 | # from https://github.com/openai/guided-diffusion/blob/8fb3ad9197f16bbc40620447b2742e13458d2831/guided_diffusion/image_datasets.py
import math
import random
import numpy as np
from PIL import Image
def center_crop_arr(pil_image, image_size):
"""
Center cropping implementation from ADM.
https://github.com/... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | dataset/coco.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.686080 | import os
import torch
from torch.utils.data import Dataset
from PIL import Image
class SingleFolderDataset(Dataset):
def __init__(self, directory, transform=None):
super().__init__()
self.directory = directory
self.transform = transform
self.image_paths = [os.path.join(directory, ... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | dataset/build.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.686604 | from dataset.imagenet import build_imagenet, build_imagenet_code
from dataset.coco import build_coco
from dataset.openimage import build_openimage
from dataset.pexels import build_pexels
from dataset.t2i import build_t2i, build_t2i_code, build_t2i_image
def build_dataset(args, **kwargs):
# images
if args.data... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | dataset/imagenet.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.705695 | import torch
import numpy as np
import os
from torch.utils.data import Dataset
from torchvision.datasets import ImageFolder
class CustomDataset(Dataset):
def __init__(self, feature_dir, label_dir):
self.feature_dir = feature_dir
self.label_dir = label_dir
self.flip = 'flip' in self.feature... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/train/extract_codes_t2i.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.789070 | # Modified from:
# fast-DiT: https://github.com/chuanyangjin/fast-DiT/blob/main/extract_features.py
import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import torch.distributed as dist
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.distributed impor... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/serve/sampler.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.912112 | """A layer that samples the next tokens from the model's outputs."""
import itertools
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
from vllm.model_executor.layers.ops.sample import sample as sample_triton
from vllm.model_executor.sampling_metadata import (SamplingMetadata,
... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/train/train_c2i.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:56.913544 | # Modified from:
# fast-DiT: https://github.com/chuanyangjin/fast-DiT/blob/main/train.py
# nanoGPT: https://github.com/karpathy/nanoGPT/blob/master/model.py
import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import torch.distributed as dist
from torch.nn.parallel import... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | dataset/openimage.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:57.202432 | import os
import json
import numpy as np
from PIL import Image
import torch
from torch.utils.data import Dataset
class DatasetJson(Dataset):
def __init__(self, data_path, transform=None):
super().__init__()
self.data_path = data_path
self.transform = transform
json_path = os.path.... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | dataset/pexels.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:57.204135 | from torchvision.datasets import ImageFolder
def build_pexels(args, transform):
return ImageFolder(args.data_path, transform=transform) |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | dataset/t2i.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:57.224919 | import os
import json
import numpy as np
import torch
from torch.utils.data import Dataset
from PIL import Image
class Text2ImgDatasetImg(Dataset):
def __init__(self, lst_dir, face_lst_dir, transform):
img_path_list = []
valid_file_path = []
# collect valid jsonl
for lst_name in ... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | language/extract_t5_feature.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:57.337324 | import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import torch.distributed as dist
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.distributed import DistributedSampler
import numpy as np
import argparse
import os
import json
from utils.distributed ... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | evaluations/c2i/evaluator.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:57.390367 | import argparse
import io
import os
import random
import warnings
import zipfile
from abc import ABC, abstractmethod
from contextlib import contextmanager
from functools import partial
from multiprocessing import cpu_count
from multiprocessing.pool import ThreadPool
from typing import Iterable, Optional, Tuple
import ... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | evaluations/t2i/evaluation.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:57.419350 | # Modified from:
# GigaGAN: https://github.com/mingukkang/GigaGAN
import os
import torch
import numpy as np
import re
import io
import random
from pathlib import Path
from tqdm import tqdm
from PIL import Image
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torchvision.datasets... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | language/t5.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:57.469384 | # Modified from:
# PixArt: https://github.com/PixArt-alpha/PixArt-alpha/blob/master/diffusion/model/t5.py
import os
import re
import html
import urllib.parse as ul
import ftfy
import torch
from bs4 import BeautifulSoup
from transformers import T5EncoderModel, AutoTokenizer
from huggingface_hub import hf_hub_download... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/consistencydecoder/cd_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:57.973013 | import argparse
import torch
import torch.nn.functional as F
import numpy as np
from PIL import Image
from diffusers import ConsistencyDecoderVAE
def main(args):
# Setup PyTorch:
torch.manual_seed(args.seed)
torch.set_grad_enabled(False)
device = "cuda" if torch.cuda.is_available() else "cpu"
# c... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/consistencydecoder/reconstruction_cd_ddp.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:57.974343 | import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import torch.distributed as dist
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.distributed import DistributedSampler
from torchvision.datasets import ImageFolder
from torchvision import transforms
f... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/tokenizer_image/discriminator_stylegan.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:58.318285 | # Modified from:
# stylegan2-pytorch: https://github.com/lucidrains/stylegan2-pytorch/blob/master/stylegan2_pytorch/stylegan2_pytorch.py
# stylegan2-pytorch: https://github.com/rosinality/stylegan2-pytorch/blob/master/model.py
# maskgit: https://github.com/google-research/maskgit/blob/main/maskgit/nets/discrimina... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/tokenizer_image/vq_loss.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:58.396749 | # Modified from:
# taming-transformers: https://github.com/CompVis/taming-transformers
# muse-maskgit-pytorch: https://github.com/lucidrains/muse-maskgit-pytorch/blob/main/muse_maskgit_pytorch/vqgan_vae.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from tokenizer.tokenizer_image.lpips impo... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/tokenizer_image/reconstruction_vq_ddp.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:58.426895 | import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import torch.nn.functional as F
import torch.distributed as dist
from torch.utils.data import DataLoader
from torch.utils.data.distributed import DistributedSampler
from torchvision import transforms
from tqdm import tqdm
i... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/tokenizer_image/vq_model.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:58.539408 | # Modified from:
# taming-transformers: https://github.com/CompVis/taming-transformers
# maskgit: https://github.com/google-research/maskgit
from dataclasses import dataclass, field
from typing import List
import torch
import torch.nn as nn
import torch.nn.functional as F
@dataclass
class ModelArgs:
codebook... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/tokenizer_image/vq_model_hf.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:58.558037 | from huggingface_hub import PyTorchModelHubMixin
from tokenizer.tokenizer_image.vq_model import ModelArgs, VQModel
class VQModelHF(VQModel, PyTorchModelHubMixin, repo_url="https://github.com/FoundationVision/LlamaGen", license="mit", tags=["llamagen", "text-to-image"]):
pass
#####################################... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/tokenizer_image/discriminator.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:59.324518 | # Modified from:
# taming-transformers: https://github.com/CompVis/taming-transformers
# stylegan2-pytorch: https://github.com/rosinality/stylegan2-pytorch/blob/master/model.py
# maskgit: https://github.com/google-research/maskgit/blob/main/maskgit/nets/discriminator.py
import functools
import math
import tor... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/tokenizer_image/discriminator_patchgan.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:59.325088 | # Modified from:
# taming-transformers: https://github.com/CompVis/taming-transformers
import functools
import torch
import torch.nn as nn
class NLayerDiscriminator(nn.Module):
"""Defines a PatchGAN discriminator as in Pix2Pix
--> see https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix/blob/master/... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/vae/reconstruction_vae_ddp.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:59.326745 | import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import torch.distributed as dist
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.distributed import DistributedSampler
from torchvision.datasets import ImageFolder
from torchvision import transforms
f... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/vae/sd_vae_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:59.327575 | import argparse
import torch
import torch.nn.functional as F
import numpy as np
from PIL import Image
from diffusers.models import AutoencoderKL
def main(args):
# Setup PyTorch:
torch.manual_seed(args.seed)
torch.set_grad_enabled(False)
device = "cuda" if torch.cuda.is_available() else "cpu"
# cr... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/tokenizer_image/vq_train.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:59.456843 | # Modified from:
# fast-DiT: https://github.com/chuanyangjin/fast-DiT/blob/main/train.py
# nanoGPT: https://github.com/karpathy/nanoGPT/blob/master/model.py
import torch
# the first flag below was False when we tested this script but True makes A100 training a lot faster:
torch.backends.cuda.matmul.allow_tf32 = Tru... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/validation/val_ddp.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:59.488737 | import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import torch.distributed as dist
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.distributed import DistributedSampler
from torchvision.datasets import ImageFolder
from torchvision import transforms
f... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/vqgan/layer.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:59.520762 | # pytorch_diffusion + derived encoder decoder
import math
import torch
import torch.nn as nn
import numpy as np
def nonlinearity(x):
# swish
return x*torch.sigmoid(x)
def Normalize(in_channels):
return torch.nn.GroupNorm(num_groups=32, num_channels=in_channels, eps=1e-6, affine=True)
class Upsample(nn... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | autoregressive/sample/sample_c2i_ddp.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:59.740301 | # Modified from:
# DiT: https://github.com/facebookresearch/DiT/blob/main/sample_ddp.py
import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import torch.nn.functional as F
import torch.distributed as dist
from tqdm import tqdm
import os
from PIL import Image
import numpy... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/vqgan/quantize.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:59.912065 | 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
_____________________... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/vqgan/model.py | null | null | null | null | null | null | Python | 2026-05-04T01:46:59.972289 | import torch
import torch.nn as nn
import torch.nn.functional as F
from tokenizer.vqgan.layer import Encoder, Decoder
from tokenizer.vqgan.quantize import VectorQuantizer2 as VectorQuantizer
VQGAN_FROM_TAMING = {
'vqgan_imagenet_f16_1024': (
'tokenizer/vqgan/configs/vqgan_imagenet_f16_1024.yaml',
... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/tokenizer_image/lpips.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:03.036420 | """Stripped version of https://github.com/richzhang/PerceptualSimilarity/tree/master/models"""
import os, hashlib
import requests
from tqdm import tqdm
import torch
import torch.nn as nn
from torchvision import models
from collections import namedtuple
URL_MAP = {
"vgg_lpips": "https://heibox.uni-heidelberg.de/f... |
FoundationVision/LlamaGen | https://github.com/FoundationVision/LlamaGen | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | tokenizer/tokenizer_image/vq_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:03.182678 | import torch
import torch.nn.functional as F
import os
import argparse
import numpy as np
from PIL import Image
from tokenizer.tokenizer_image.vq_model import VQ_models
from dataset.augmentation import center_crop_arr
def main(args):
# Setup PyTorch:
torch.manual_seed(args.seed)
torch.set_grad_enabled(F... |
denuitt1/mhr-cfw | https://github.com/denuitt1/mhr-cfw | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | src/cert_installer.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:05.124999 | """
Cross-platform trusted CA certificate installer.
Supports: Windows, macOS, Linux (Debian/Ubuntu, RHEL/Fedora/CentOS, Arch).
Also attempts to install into Firefox's NSS certificate store when found.
Usage:
from cert_installer import install_ca, is_ca_trusted
install_ca("/path/to/ca.crt", cert_name="mhr-cfw... |
denuitt1/mhr-cfw | https://github.com/denuitt1/mhr-cfw | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | src/lan_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:05.146652 | """
LAN utilities for detecting network interfaces and IPv4 addresses.
Provides functionality to enumerate local IPv4 addresses for LAN proxy
sharing. IPv6 is intentionally not reported — this project only exposes
the proxy over IPv4 LANs, which is what every consumer router and
phone/desktop client actually uses.
Im... |
denuitt1/mhr-cfw | https://github.com/denuitt1/mhr-cfw | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | src/h2_transport.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:05.155124 | """
HTTP/2 multiplexed transport for domain-fronted connections.
One TLS connection → many concurrent HTTP/2 streams → massive throughput.
Eliminates per-request TLS handshake overhead entirely.
Instead of a pool of 30 HTTP/1.1 connections (each handling 1 request),
this uses a SINGLE HTTP/2 connection handling 100+ ... |
denuitt1/mhr-cfw | https://github.com/denuitt1/mhr-cfw | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | src/logging_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:05.155933 | """
Pretty, column-aligned, color-aware logging.
Zero extra dependencies. On Windows, ANSI color support is enabled via
the Console API. Colors are disabled automatically when:
- The output stream is not a TTY (e.g. piped to a file)
- The NO_COLOR environment variable is set
- DFT_NO_COLOR=1 is set
"""
from __... |
denuitt1/mhr-cfw | https://github.com/denuitt1/mhr-cfw | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | src/constants.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:05.165702 | """
Central location for tunable constants used across the project.
Values here are chosen for safe defaults; individual entries may be
overridden from `config.json` where noted.
"""
from __future__ import annotations
# ── Version ───────────────────────────────────────────────────────────────
__version__ = "2.0.1"
... |
denuitt1/mhr-cfw | https://github.com/denuitt1/mhr-cfw | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | src/codec.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:05.166797 | """
Content-Encoding decoders: gzip (stdlib), brotli (optional), zstd (optional).
`decode(body, encoding)` returns the decoded bytes, or the original bytes
on any error. Use `supported_encodings()` to build an Accept-Encoding value.
"""
from __future__ import annotations
import gzip
import logging
import zlib
log ... |
denuitt1/mhr-cfw | https://github.com/denuitt1/mhr-cfw | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | setup.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:05.169357 | #!/usr/bin/env python3
"""Interactive setup wizard.
Writes a ready-to-use config.json by prompting only for the values
the user really has to choose. Everything else gets a sane default.
Run:
python setup.py
"""
from __future__ import annotations
import json
import os
import secrets
import shutil
import string
... |
denuitt1/mhr-cfw | https://github.com/denuitt1/mhr-cfw | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | src/google_ip_scanner.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:05.170328 | """
Google IP Scanner — finds the fastest reachable Google frontend IP.
Scans a list of candidate Google IPs via HTTPS (with SNI fronting), measures
latency, and reports results in a formatted table. Useful for finding the best
IP to configure in config.json when your current IP is blocked.
"""
from __future__ import... |
denuitt1/mhr-cfw | https://github.com/denuitt1/mhr-cfw | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | main.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:05.178801 | #!/usr/bin/env python3
"""
DomainFront Tunnel — Bypass DPI censorship via GAS (Google Apps Script) and Cloudflare Workers.
Run a local HTTP proxy that tunnels all traffic through a Google Apps
Script relay fronted by www.google.com (TLS SNI shows www.google.com
while the encrypted Host header points at script.google.c... |
denuitt1/mhr-cfw | https://github.com/denuitt1/mhr-cfw | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | src/domain_fronter.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:05.185118 | """
GAS Domain fronting relay engine.
Domain fronting via Google Apps Script: POST JSON to script.google.com
(fronted through www.google.com). Apps Script fetches the target URL and
returns the response.
relay() — JSON-based HTTP relay through Apps Script
"""
import asyncio
import base64
import hashlib
import js... |
denuitt1/mhr-cfw | https://github.com/denuitt1/mhr-cfw | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | src/mitm.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:05.880270 | """
MITM certificate manager for HTTPS interception.
Generates a CA certificate (once, stored as files) and per-domain
certificates (on the fly, cached in memory) so the local proxy can
decrypt HTTPS traffic and relay it through Apps Script.
The user must install ca/ca.crt in their browser's trusted CAs once.
Requir... |
denuitt1/mhr-cfw | https://github.com/denuitt1/mhr-cfw | null | null | null | null | 1,948 | null | null | mit | null | null | null | null | null | null | null | src/proxy_server.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:05.941511 | """
Local HTTP proxy server.
Intercepts the user's browser traffic and forwards everything through
the Apps Script relay (MITM-decrypts HTTPS locally, forwards requests
as JSON to script.google.com fronted through www.google.com).
"""
import asyncio
import logging
import re
import socket
import ssl
import time
import... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/elastic_nn/modules/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:07.913403 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
from .dynamic_layers import *
from .dynamic_op import *
|
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | eval_specialized_net.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:07.915427 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import os
import os.path as osp
import argparse
import math
from tqdm import tqdm
import torch.nn as nn
import t... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | hubconf.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:07.925710 | dependencies = ['torch', 'torchvision']
from functools import partial
from ofa.model_zoo import ofa_net, ofa_specialized
# general model
ofa_supernet_resnet50 = partial(ofa_net, net_id="ofa_resnet50", pretrained=True)
ofa_supernet_mbv3_w10 = partial(ofa_net, net_id="ofa_mbv3_d234_e346_k357_w1.0", pretrained=True)
ofa... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/data_providers/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:07.941086 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
from .imagenet import *
|
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/data_providers/imagenet.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:07.946135 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import warnings
import os
import math
import numpy as np
import torch.utils.data
import torchvision.transforms as... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | eval_ofa_net.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:07.950375 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import os
import torch
import argparse
from ofa.imagenet_classification.data_providers.imagenet import ImagenetD... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/data_providers/base_provider.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:07.994258 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import numpy as np
import torch
__all__ = ["DataProvider"]
class DataProvider:
SUB_SEED = 937162211 # ran... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/elastic_nn/modules/dynamic_op.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:08.491801 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import torch.nn.functional as F
import torch.nn as nn
import torch
from torch.nn.parameter import Parameter
from... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/elastic_nn/networks/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:08.519596 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
from .ofa_proxyless import OFAProxylessNASNets
from .ofa_mbv3 import OFAMobileNetV3
from .ofa_resnets import OFAR... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/elastic_nn/networks/ofa_proxyless.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:08.545503 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import copy
import random
from ofa.utils import make_divisible, val2list, MyNetwork
from ofa.imagenet_classifica... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/elastic_nn/training/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:08.570708 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
from .progressive_shrinking import *
|
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/elastic_nn/modules/dynamic_layers.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:08.576155 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import copy
import torch
import torch.nn as nn
from collections import OrderedDict
from ofa.utils.layers import ... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/elastic_nn/training/progressive_shrinking.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:08.586570 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import torch.nn as nn
import random
import time
import torch
import torch.nn.functional as F
from tqdm import tqd... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/elastic_nn/networks/ofa_mbv3.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:08.589955 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import copy
import random
from ofa.imagenet_classification.elastic_nn.modules.dynamic_layers import (
Dynami... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/elastic_nn/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:08.593166 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import copy
import torch.nn.functional as F
import torch.nn as nn
import torch
from ofa.utils import AverageMete... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/elastic_nn/networks/ofa_resnets.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:08.594294 | import random
from ofa.imagenet_classification.elastic_nn.modules.dynamic_layers import (
DynamicConvLayer,
DynamicLinearLayer,
)
from ofa.imagenet_classification.elastic_nn.modules.dynamic_layers import (
DynamicResNetBottleneckBlock,
)
from ofa.utils.layers import IdentityLayer, ResidualBlock
from ofa.im... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/networks/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:08.606106 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
from .proxyless_nets import *
from .mobilenet_v3 import *
from .resnets import *
def get_net_by_name(name):
... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/model_zoo.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:09.384464 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import json
import torch
import gdown
from ofa.utils import download_url
from ofa.imagenet_classification.networ... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/networks/resnets.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:09.385281 | import torch.nn as nn
from ofa.utils.layers import (
set_layer_from_config,
ConvLayer,
IdentityLayer,
LinearLayer,
)
from ofa.utils.layers import ResNetBottleneckBlock, ResidualBlock
from ofa.utils import make_divisible, MyNetwork, MyGlobalAvgPool2d
__all__ = ["ResNets", "ResNet50", "ResNet50D"]
cla... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/run_manager/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:09.390159 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
from .run_config import *
from .run_manager import *
from .distributed_run_manager import *
|
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/networks/proxyless_nets.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:09.391176 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import json
import torch.nn as nn
from ofa.utils.layers import (
set_layer_from_config,
MBConvLayer,
... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/run_manager/run_manager.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:09.398445 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import os
import random
import time
import json
import numpy as np
import torch.nn as nn
import torch.nn.function... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/run_manager/distributed_run_manager.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:09.399925 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import os
import json
import time
import random
import torch
import torch.nn as nn
import torch.nn.functional as ... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/networks/mobilenet_v3.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:10.113169 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import copy
import torch.nn as nn
from ofa.utils.layers import (
set_layer_from_config,
MBConvLayer,
... |
mit-han-lab/once-for-all | https://github.com/mit-han-lab/once-for-all | null | null | null | null | 1,947 | null | null | mit | null | null | null | null | null | null | null | ofa/imagenet_classification/run_manager/run_config.py | null | null | null | null | null | null | Python | 2026-05-04T01:47:10.203383 | # Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
from ofa.utils import calc_learning_rate, build_optimizer
from ofa.imagenet_classification.data_providers import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.