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
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/dataset/math_function.py
null
null
null
null
null
null
Python
2026-05-04T02:21:30.568869
""" Math Functions """ import polars as pl from .utility import DataProxy def less(feature1: DataProxy, feature2: DataProxy | float) -> DataProxy: """Return the minimum value between two features""" if isinstance(feature2, DataProxy): df_merged: pl.DataFrame = feature1.df.join(feature2.df, on=["date...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:21:30.569382
# The MIT License (MIT) # Copyright (c) 2015-present, Xiaoyou Chen # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, cop...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/dataset/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:21:30.575868
from .template import AlphaDataset from .utility import Segment, to_datetime from .processor import ( process_drop_na, process_fill_na, process_cs_norm, process_robust_zscore_norm, process_cs_rank_norm ) __all__ = [ "AlphaDataset", "Segment", "to_datetime", "process_drop_na", "...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/dataset/datasets/alpha_158.py
null
null
null
null
null
null
Python
2026-05-04T02:21:30.605827
import polars as pl from vnpy.alpha import AlphaDataset class Alpha158(AlphaDataset): """158 basic factors from Qlib""" def __init__( self, df: pl.DataFrame, train_period: tuple[str, str], valid_period: tuple[str, str], test_period: tuple[str, str] ) -> None: ...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/dataset/cs_function.py
null
null
null
null
null
null
Python
2026-05-04T02:21:30.608083
""" Cross Section Operators """ import polars as pl from .utility import DataProxy def cs_rank(feature: DataProxy) -> DataProxy: """Perform cross-sectional ranking""" df: pl.DataFrame = feature.df.select( pl.col("datetime"), pl.col("vt_symbol"), pl.col("data").rank().over("datetime")...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/dataset/datasets/alpha_101.py
null
null
null
null
null
null
Python
2026-05-04T02:21:30.609301
import polars as pl from vnpy.alpha import AlphaDataset class Alpha101(AlphaDataset): """101 basic factors from WorldQuant""" def __init__( self, df: pl.DataFrame, train_period: tuple[str, str], valid_period: tuple[str, str], test_period: tuple[str, str] ) -> None...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/dataset/processor.py
null
null
null
null
null
null
Python
2026-05-04T02:21:30.652684
from datetime import datetime import numpy as np import polars as pl from .utility import to_datetime def process_drop_na(df: pl.DataFrame, names: list[str] | None = None) -> pl.DataFrame: """Remove rows with missing values""" if names is None: names = df.columns[2:-1] for name in names: ...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/dataset/ta_function.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.098529
""" Technical Analysis Operators """ import talib import polars as pl import pandas as pd from .utility import DataProxy def to_pd_series(feature: DataProxy) -> pd.Series: """Convert to pandas.Series data structure""" series: pd.Series = feature.df.to_pandas().set_index(["datetime", "vt_symbol"])["data"] ...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/dataset/template.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.125724
import time from datetime import datetime from typing import cast from collections.abc import Callable from multiprocessing import get_context from multiprocessing.context import BaseContext import polars as pl import pandas as pd from tqdm import tqdm from alphalens.utils import get_clean_factor_and_forward_returns ...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/lab.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.165589
import json import shelve import pickle from pathlib import Path from datetime import datetime, timedelta from collections import defaultdict from functools import lru_cache import polars as pl from vnpy.trader.object import BarData from vnpy.trader.constant import Interval from vnpy.trader.utility import extract_vt_...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/logger.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.175158
import sys from loguru import logger # Remove default output logger.remove() # Add terminal output fmt: str = "<green>{time:YYYY-MM-DD HH:mm:ss}</green> <level>{message}</level>" logger.add(sys.stdout, colorize=True, format=fmt)
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/dataset/ts_function.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.185245
"""Time Series Operators""" from typing import cast from scipy import stats import polars as pl import numpy as np from .utility import DataProxy def ts_delay(feature: DataProxy, window: int) -> DataProxy: """Get the value from a fixed time in the past""" df: pl.DataFrame = feature.df.select( pl.co...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/model/models/lasso_model.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.237776
import numpy as np import polars as pl from sklearn.linear_model import Lasso # type: ignore from vnpy.alpha import ( AlphaDataset, AlphaModel, Segment, logger ) class LassoModel(AlphaModel): """LASSO regression learning algorithm""" def __init__( self, alpha: float = 0....
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/model/models/lgb_model.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.284465
from typing import cast import numpy as np import polars as pl import lightgbm as lgb import matplotlib.pyplot as plt from vnpy.alpha.dataset import AlphaDataset, Segment from vnpy.alpha.model import AlphaModel class LgbModel(AlphaModel): """LightGBM ensemble learning algorithm""" def __init__( sel...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/dataset/utility.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.287431
from datetime import datetime from enum import Enum from typing import Union import polars as pl class DataProxy: """Feature data proxy""" def __init__(self, df: pl.DataFrame) -> None: """Constructor""" self.name: str = df.columns[-1] self.df: pl.DataFrame = df.rename({self.name: "da...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/model/models/mlp_model.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.698800
import copy from collections import defaultdict from typing import Literal, cast import numpy as np import pandas as pd import polars as pl from sklearn.metrics import mean_squared_error # type: ignore import torch import torch.nn as nn import torch.optim as optim from vnpy.alpha import ( AlphaDataset, A...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/model/template.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.729913
from abc import ABCMeta, abstractmethod from typing import Any import numpy as np from vnpy.alpha.dataset import AlphaDataset, Segment class AlphaModel(metaclass=ABCMeta): """Template class for machine learning algorithms""" @abstractmethod def fit(self, dataset: AlphaDataset) -> None: """ ...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/strategy/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.746828
from .template import AlphaStrategy from .backtesting import BacktestingEngine __all__ = [ "AlphaStrategy", "BacktestingEngine" ]
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/strategy/strategies/equity_demo_strategy.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.842324
from collections import defaultdict import polars as pl from vnpy.trader.object import BarData, TradeData from vnpy.trader.constant import Direction from vnpy.trader.utility import round_to from vnpy.alpha import AlphaStrategy class EquityDemoStrategy(AlphaStrategy): """Equity Long-Only Demo Strategy""" t...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/strategy/template.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.858350
from abc import ABCMeta, abstractmethod from collections import defaultdict from typing import TYPE_CHECKING import polars as pl from vnpy.trader.object import BarData, TradeData, OrderData from vnpy.trader.constant import Offset, Direction if TYPE_CHECKING: from vnpy.alpha.strategy.backtesting import Backtesti...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/chart/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.866751
from .widget import ChartWidget from .item import CandleItem, VolumeItem __all__ = [ "ChartWidget", "CandleItem", "VolumeItem", ]
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/chart/base.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.881863
from vnpy.trader.ui import QtGui WHITE_COLOR = (255, 255, 255) BLACK_COLOR = (0, 0, 0) GREY_COLOR = (100, 100, 100) UP_COLOR = (255, 75, 75) DOWN_COLOR = (0, 255, 255) CURSOR_COLOR = (255, 245, 162) PEN_WIDTH = 1 BAR_WIDTH = 0.3 AXIS_WIDTH = 0.8 NORMAL_FONT = QtGui.QFont("Arial", 9) def to_int(value: float) -> i...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/alpha/strategy/backtesting.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.941320
from collections import defaultdict from datetime import date, datetime from copy import copy from typing import cast import traceback import numpy as np import polars as pl import plotly.graph_objects as go # type: ignore from plotly.subplots import make_subplots # type: ignore from tqdm import tq...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/chart/axis.py
null
null
null
null
null
null
Python
2026-05-04T02:21:31.992962
from datetime import datetime from typing import Any import pyqtgraph as pg # type: ignore from .manager import BarManager from .base import AXIS_WIDTH, NORMAL_FONT, QtGui class DatetimeAxis(pg.AxisItem): """""" def __init__(self, manager: BarManager, *args: Any, **kwargs: Any) -> None: """"""...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/chart/item.py
null
null
null
null
null
null
Python
2026-05-04T02:21:32.246972
from abc import abstractmethod import pyqtgraph as pg # type: ignore from vnpy.trader.ui import QtCore, QtGui, QtWidgets from vnpy.trader.object import BarData from .base import BLACK_COLOR, UP_COLOR, DOWN_COLOR, PEN_WIDTH, BAR_WIDTH from .manager import BarManager class ChartItem(pg.GraphicsObject): """"...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/chart/widget.py
null
null
null
null
null
null
Python
2026-05-04T02:21:32.327552
from datetime import datetime import pyqtgraph as pg # type: ignore from vnpy.trader.ui import QtGui, QtWidgets, QtCore from vnpy.trader.object import BarData from .manager import BarManager from .base import ( GREY_COLOR, WHITE_COLOR, CURSOR_COLOR, BLACK_COLOR, to_int, NORMAL_FONT ) from .axis import D...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/chart/manager.py
null
null
null
null
null
null
Python
2026-05-04T02:21:32.427340
from datetime import datetime from _collections_abc import dict_keys from vnpy.trader.object import BarData from .base import to_int class BarManager: """""" def __init__(self) -> None: """""" self._bars: dict[datetime, BarData] = {} self._datetime_index_map: dict[datetime, int] = {...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/event/engine.py
null
null
null
null
null
null
Python
2026-05-04T02:21:32.427811
""" Event-driven framework of VeighNa framework. """ from collections import defaultdict from collections.abc import Callable from queue import Empty, Queue from threading import Thread from time import sleep from typing import Any EVENT_TIMER = "eTimer" class Event: """ Event object consists of a type str...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/rpc/client.py
null
null
null
null
null
null
Python
2026-05-04T02:21:32.468210
import threading from time import time from functools import lru_cache from typing import Any import zmq from .common import HEARTBEAT_TOPIC, HEARTBEAT_TOLERANCE class RemoteException(Exception): """ RPC remote exception """ def __init__(self, value: Any) -> None: """ Constructor ...
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/event/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:21:32.497533
from .engine import Event, EventEngine, EVENT_TIMER __all__ = [ "Event", "EventEngine", "EVENT_TIMER", ]
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/rpc/common.py
null
null
null
null
null
null
Python
2026-05-04T02:21:32.575943
import signal # Achieve Ctrl-c interrupt recv signal.signal(signal.SIGINT, signal.SIG_DFL) HEARTBEAT_TOPIC = "heartbeat" HEARTBEAT_INTERVAL = 10 HEARTBEAT_TOLERANCE = 30
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/rpc/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:21:32.576766
from .client import RpcClient from .server import RpcServer __all__ = [ "RpcClient", "RpcServer", ]
vnpy/vnpy
https://github.com/vnpy/vnpy
null
null
null
null
40,081
null
null
mit
null
null
null
null
null
null
null
vnpy/rpc/server.py
null
null
null
null
null
null
Python
2026-05-04T02:21:32.659196
import threading import traceback from time import time from collections.abc import Callable import zmq from .common import HEARTBEAT_TOPIC, HEARTBEAT_INTERVAL class RpcServer: """""" def __init__(self) -> None: """ Constructor """ # Save functions dict: key is function name...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
gpu/generate.py
null
null
null
null
null
null
Python
2026-05-04T02:21:35.414148
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import json import os import readline # type: ignore # noqa import sys import time from dataclasses import dat...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
gpu/convert_checkpoint.py
null
null
null
null
null
null
Python
2026-05-04T02:21:35.460208
import json import os import re import sys from pathlib import Path from typing import Optional from dataclasses import dataclass import torch from einops import rearrange from safetensors.torch import save_file import model from pack_weight import convert_weight_int8_to_int2 @torch.inference_mode() def ...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
gpu/convert_safetensors.py
null
null
null
null
null
null
Python
2026-05-04T02:21:35.460715
import re import torch from pathlib import Path from safetensors.torch import load_file from einops import rearrange from dataclasses import dataclass from typing import Optional transformer_configs = { "2B": dict(n_layer=30, n_head=20, dim=2560, vocab_size=128256, n_local_heads=5, intermediate_size=6912), } @dat...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
gpu/bitnet_kernels/setup.py
null
null
null
null
null
null
Python
2026-05-04T02:21:35.469571
from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension setup( name='bitlinear_cpp', ext_modules=[ CUDAExtension('bitlinear_cuda', [ 'bitnet_kernels.cu', ]) ], cmdclass={ 'build_ext': BuildExtension })
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
gpu/test.py
null
null
null
null
null
null
Python
2026-05-04T02:21:35.470701
import torch from torch.utils import benchmark from torch import nn from pack_weight import convert_weight_int8_to_int2 from torch.profiler import profile, record_function, ProfilerActivity import ctypes import numpy as np # set all seed torch.manual_seed(42) np.random.seed(42) bitnet_lib = ctypes.CDLL('bitnet_kernel...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
gpu/stats.py
null
null
null
null
null
null
Python
2026-05-04T02:21:35.472515
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import time from dataclasses import dataclass from typing import Optional @dataclass class PhaseStats: ...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
gpu/sample_utils.py
null
null
null
null
null
null
Python
2026-05-04T02:21:35.481219
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import torch @torch.compile def top_p(probs: torch.Tensor, p: float) -> torch.Tensor: """ Perform top-...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
gpu/model.py
null
null
null
null
null
null
Python
2026-05-04T02:21:35.482352
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from torch import nn ...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
gpu/tokenizer.py
null
null
null
null
null
null
Python
2026-05-04T02:21:35.492719
import os from logging import getLogger from pathlib import Path from typing import ( AbstractSet, cast, Collection, Dict, Iterator, List, Literal, Sequence, TypedDict, Union, ) import tiktoken from tiktoken.load import load_tiktoken_bpe logger = getLogger(...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
gpu/pack_weight.py
null
null
null
null
null
null
Python
2026-05-04T02:21:35.522370
import torch import numpy as np def B_global_16x32_to_shared_load_16x32_layout(i, j): """ stride * 8 * (tx // HALF_WARP_expr) + (tx % 8) * stride + 16 * ((tx % HALF_WARP_expr) // 8) """ thread_id = i * 2 + j // 16 row = (thread_id // 16) * 8 + (threa...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
run_inference.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.073025
import os import sys import signal import platform import argparse import subprocess def run_command(command, shell=False): """Run a system command and ensure it succeeds.""" try: subprocess.run(command, shell=shell, check=True) except subprocess.CalledProcessError as e: print(f"Error occur...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
run_inference_server.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.084260
import os import sys import signal import platform import argparse import subprocess def run_command(command, shell=False): """Run a system command and ensure it succeeds.""" try: subprocess.run(command, shell=shell, check=True) except subprocess.CalledProcessError as e: print(f"Error occur...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
setup_env.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.111568
import subprocess import signal import sys import os import platform import argparse import logging import shutil from pathlib import Path logger = logging.getLogger("setup_env") SUPPORTED_HF_MODELS = { "1bitLLM/bitnet_b1_58-large": { "model_name": "bitnet_b1_58-large", }, "1bitLLM/bitnet_b1_58-3B...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
utils/convert-helper-bitnet.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.124261
#!/usr/bin/env python3 import sys import os import shutil import subprocess from pathlib import Path def run_command(command_list, cwd=None, check=True): print(f"Executing: {' '.join(map(str, command_list))}") try: process = subprocess.run(command_list, cwd=cwd, check=check, capture_output=False, text...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
utils/convert-hf-to-gguf-bitnet.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.125613
#!/usr/bin/env python3 from __future__ import annotations import logging import argparse import contextlib import json import os import re import sys from abc import ABC, abstractmethod from enum import IntEnum from pathlib import Path from hashlib import sha256 from typing import TYPE_CHECKING, Any, Callable, Contex...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
utils/codegen_tl1.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.129763
import argparse import os from configparser import ConfigParser def gen_ctor_code(): kernel_code = "\n\ #include \"ggml-bitnet.h\"\n\ #define GGML_BITNET_MAX_NODES 8192\n\ static bool initialized = false;\n\ static bitnet_tensor_extra * bitnet_tensor_extras = nullptr;\n\ static size_t bitnet_tensor_extras_index = ...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
utils/codegen_tl2.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.132145
import argparse import os from configparser import ConfigParser def gen_ctor_code(): kernel_code = "\n\ #include \"ggml-bitnet.h\"\n\ #include <cstring>\n\ #include <immintrin.h>\n\ #define GGML_BITNET_MAX_NODES 8192\n\ static bool initialized = false;\n\ static bitnet_tensor_extra * bitnet_tensor_extras = nullptr...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
utils/convert.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.154723
#!/usr/bin/env python3 from __future__ import annotations import logging import argparse import concurrent.futures import enum import faulthandler import functools import itertools import json import math import mmap import os import re import signal import struct import sys import textwrap import time from abc import...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
utils/e2e_benchmark.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.184878
import os import sys import logging import argparse import platform import subprocess def run_command(command, shell=False, log_step=None): """Run a system command and ensure it succeeds.""" if log_step: log_file = os.path.join(args.log_dir, log_step + ".log") with open(log_file, "w") as f: ...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
utils/convert-ms-to-gguf-bitnet.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.185598
#!/usr/bin/env python3 from __future__ import annotations import logging import argparse import concurrent.futures import enum import faulthandler import functools import itertools import json import math import mmap import os import re import signal import struct import sys import textwrap import time from abc import...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
utils/generate-dummy-bitnet-model.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.685423
#!/usr/bin/env python3 # dummy model generation script based on convert-hf-to-gguf-bitnet.py from __future__ import annotations import sys from pathlib import Path import numpy as np import configparser import logging import argparse import contextlib import json import os import re import sys from abc import ABC, ab...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
utils/quantize_embeddings.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.693217
#!/usr/bin/env python3 """ Embedding Quantization Script This script converts ggml-model-f32.gguf to multiple quantized versions with different token embedding types. """ import subprocess import os import argparse import re import csv from pathlib import Path from datetime import datetime class EmbeddingQuantizer: ...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
utils/preprocess-huggingface-bitnet.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.723384
from safetensors import safe_open from safetensors.torch import save_file import torch def quant_weight_fp16(weight): weight = weight.to(torch.float) s = 1.0 / weight.abs().mean().clamp_(min=1e-5) new_weight = (weight * s).round().clamp(-1, 1) / s return new_weight def quant_model(input, output): ...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
utils/test_perplexity.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.793031
#!/usr/bin/env python3 """ Perplexity Test Script Tests GGUF model perplexity on multiple datasets using llama-perplexity. """ import os import subprocess import time import csv import re from datetime import datetime from pathlib import Path import argparse import tempfile import shutil import statistics class Perp...
microsoft/BitNet
https://github.com/microsoft/BitNet
null
null
null
null
38,793
null
null
mit
null
null
null
null
null
null
null
utils/tune_gemm_config.py
null
null
null
null
null
null
Python
2026-05-04T02:21:36.823488
#!/usr/bin/env python3 """ GEMM Configuration Tuning Script This script automatically tunes ROW_BLOCK_SIZE, COL_BLOCK_SIZE, and PARALLEL_SIZE to find the optimal configuration for maximum throughput (t/s). """ import subprocess import os import re import csv import shutil from datetime import datetime from pathlib imp...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/speed_estimation/inference_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:40.273959
import os from collections import defaultdict, deque import cv2 import numpy as np from inference.models.utils import get_roboflow_model import supervision as sv SOURCE = np.array([[1252, 787], [2298, 803], [5039, 2159], [-550, 2159]]) TARGET_WIDTH = 25 TARGET_HEIGHT = 250 TARGET = np.array( [ [0, 0], ...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/inference_file_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:40.275672
import cv2 import numpy as np from inference import get_model from utils.general import find_in_list, load_zones_config from utils.timers import FPSBasedTimer import supervision as sv COLORS = sv.ColorPalette.from_hex(["#E6194B", "#3CB44B", "#FFE119", "#3C76D1"]) COLOR_ANNOTATOR = sv.ColorAnnotator(color=COLORS) LABE...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/heatmap_and_track/script.py
null
null
null
null
null
null
Python
2026-05-04T02:21:40.280848
from typing import Optional import cv2 from ultralytics import YOLO import supervision as sv from supervision.assets import VideoAssets, download_assets def download_video() -> str: download_assets(VideoAssets.PEOPLE_WALKING) return VideoAssets.PEOPLE_WALKING.value def main( source_weig...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/speed_estimation/ultralytics_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:40.282343
from collections import defaultdict, deque import cv2 import numpy as np from ultralytics import YOLO import supervision as sv SOURCE = np.array([[1252, 787], [2298, 803], [5039, 2159], [-550, 2159]]) TARGET_WIDTH = 25 TARGET_HEIGHT = 250 TARGET = np.array( [ [0, 0], [TARGET_WIDTH - 1, 0], ...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/count_people_in_zone/inference_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:40.283585
import json import os import cv2 import numpy as np from inference.core.models.roboflow import RoboflowInferenceModel from inference.models.utils import get_roboflow_model from tqdm import tqdm import supervision as sv COLORS = sv.ColorPalette.DEFAULT def load_zones_config(file_path: str) -> list[np.ndarray]: ...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/speed_estimation/yolo_nas_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:40.284513
from collections import defaultdict, deque import cv2 import numpy as np from super_gradients.common.object_names import Models from super_gradients.training import models import supervision as sv SOURCE = np.array([[1252, 787], [2298, 803], [5039, 2159], [-550, 2159]]) TARGET_WIDTH = 25 TARGET_HEIGHT = 250 TARGET...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/compact_mask/benchmark.py
null
null
null
null
null
null
Python
2026-05-04T02:21:40.285920
"""CompactMask demo & benchmark. Demonstrates that ``CompactMask`` is a drop-in replacement for dense ``(N, H, W)`` bool arrays in ``supervision.Detections``, while using significantly less memory and enabling faster annotation. Run with: uv run python examples/compact_mask/benchmark.py No GPU or real model is r...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/count_people_in_zone/ultralytics_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:40.354661
import json import cv2 import numpy as np from tqdm import tqdm from ultralytics import YOLO import supervision as sv COLORS = sv.ColorPalette.DEFAULT def load_zones_config(file_path: str) -> list[np.ndarray]: """ Load polygon zone configurations from a JSON file. This function reads a JSON file which...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
.github/scripts/augment_links.py
null
null
null
null
null
null
Python
2026-05-04T02:21:40.477496
#!/usr/bin/env python3 """ Script to augment relative links in markdown files to GitHub URLs. """ import argparse import os import re from re import Match def get_repo_root() -> str: """Get the repository root path.""" script_dir = os.path.dirname(os.path.abspath(__file__)) return os.path.dirname(os.path...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/speed_estimation/video_downloader.py
null
null
null
null
null
null
Python
2026-05-04T02:21:40.478051
import os from supervision.assets import VideoAssets, download_assets if not os.path.exists("data"): os.makedirs("data") os.chdir("data") download_assets(VideoAssets.VEHICLES)
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/rfdetr_stream_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:41.121899
from __future__ import annotations from enum import Enum import cv2 import numpy as np from inference import InferencePipeline from inference.core.interfaces.camera.entities import VideoFrame from rfdetr import RFDETRBase, RFDETRLarge, RFDETRMedium, RFDETRNano, RFDETRSmall from utils.general import find_in_list, load...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/scripts/stream_from_file.py
null
null
null
null
null
null
Python
2026-05-04T02:21:41.296834
import os import subprocess import tempfile from glob import glob from threading import Thread import yaml from jsonargparse import auto_cli SERVER_CONFIG = {"protocols": ["tcp"], "paths": {"all": {"source": "publisher"}}} BASE_STREAM_URL = "rtsp://localhost:8554/live" def main(video_directory: str, number_of_strea...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/inference_stream_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:41.299232
import cv2 import numpy as np from inference import InferencePipeline from inference.core.interfaces.camera.entities import VideoFrame from utils.general import find_in_list, load_zones_config from utils.timers import ClockBasedTimer import supervision as sv COLORS = sv.ColorPalette.from_hex(["#E6194B", "#3CB44B", "#...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/rfdetr_naive_stream_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:41.300184
from __future__ import annotations from enum import Enum import cv2 import numpy as np from rfdetr import RFDETRBase, RFDETRLarge, RFDETRMedium, RFDETRNano, RFDETRSmall from utils.general import find_in_list, get_stream_frames_generator, load_zones_config from utils.timers import ClockBasedTimer import supervision a...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/ultralytics_file_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:41.301359
import cv2 import numpy as np from ultralytics import YOLO from utils.general import find_in_list, load_zones_config from utils.timers import FPSBasedTimer import supervision as sv COLORS = sv.ColorPalette.from_hex(["#E6194B", "#3CB44B", "#FFE119", "#3C76D1"]) COLOR_ANNOTATOR = sv.ColorAnnotator(color=COLORS) LABEL_A...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/scripts/download_from_youtube.py
null
null
null
null
null
null
Python
2026-05-04T02:21:41.303257
from __future__ import annotations import os import sys from typing import Any import yt_dlp from jsonargparse import auto_cli from yt_dlp.utils import DownloadError def _build_ydl_opts(output_path: str | None, file_name: str | None) -> dict[str, Any]: out_dir = output_path or "." if not os.path.exists(out...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/scripts/draw_zones.py
null
null
null
null
null
null
Python
2026-05-04T02:21:41.304320
from __future__ import annotations import json import os from typing import Any import cv2 import numpy as np from jsonargparse import auto_cli import supervision as sv KEY_ENTER = 13 KEY_NEWLINE = 10 KEY_ESCAPE = 27 KEY_QUIT = ord("q") KEY_SAVE = ord("s") THICKNESS = 2 COLORS = sv.ColorPalette.DEFAULT WINDOW_NAME...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/inference_naive_stream_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:41.380312
import cv2 import numpy as np from inference import get_model from utils.general import find_in_list, get_stream_frames_generator, load_zones_config from utils.timers import ClockBasedTimer import supervision as sv COLORS = sv.ColorPalette.from_hex(["#E6194B", "#3CB44B", "#FFE119", "#3C76D1"]) COLOR_ANNOTATOR = sv.Co...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/ultralytics_naive_stream_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:41.384045
import cv2 import numpy as np from ultralytics import YOLO from utils.general import find_in_list, get_stream_frames_generator, load_zones_config from utils.timers import ClockBasedTimer import supervision as sv COLORS = sv.ColorPalette.from_hex(["#E6194B", "#3CB44B", "#FFE119", "#3C76D1"]) COLOR_ANNOTATOR = sv.Color...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/rfdetr_file_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:41.501538
from __future__ import annotations from enum import Enum import cv2 import numpy as np from rfdetr import RFDETRBase, RFDETRLarge, RFDETRMedium, RFDETRNano, RFDETRSmall from utils.general import find_in_list, load_zones_config from utils.timers import FPSBasedTimer import supervision as sv COLORS = sv.ColorPalette....
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/ultralytics_stream_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.077927
from __future__ import annotations import cv2 import numpy as np from inference import InferencePipeline from inference.core.interfaces.camera.entities import VideoFrame from ultralytics import YOLO from utils.general import find_in_list, load_zones_config from utils.timers import ClockBasedTimer import supervision a...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/traffic_analysis/inference_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.087200
from __future__ import annotations import os from collections.abc import Iterable import cv2 import numpy as np from inference.models.utils import get_roboflow_model from tqdm import tqdm import supervision as sv COLORS = sv.ColorPalette.from_hex(["#E6194B", "#3CB44B", "#FFE119", "#3C76D1"]) ZONE_IN_POLYGONS = [ ...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/tracking/ultralytics_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.190552
from tqdm import tqdm from ultralytics import YOLO import supervision as sv def main( source_weights_path: str, source_video_path: str, target_video_path: str, confidence_threshold: float = 0.3, iou_threshold: float = 0.7, ) -> None: """ Video Processing with YOLO and ByteTrack. Args...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/tracking/inference_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.198879
import os from inference.models.utils import get_roboflow_model from tqdm import tqdm import supervision as sv def main( source_video_path: str, target_video_path: str, roboflow_api_key: str, model_id: str = "yolov8x-1280", confidence_threshold: float = 0.3, iou_threshold: float = 0.7, ) -> ...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/utils/timers.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.202757
from datetime import datetime import numpy as np import supervision as sv class FPSBasedTimer: """ A timer that calculates the duration each object has been detected based on frames per second (FPS). Attributes: fps (float): The frame rate of the video stream, used to calculate ...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/time_in_zone/utils/general.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.210187
import json from collections.abc import Generator import cv2 import numpy as np def load_zones_config(file_path: str) -> list[np.ndarray]: """ Load polygon zone configurations from a JSON file. This function reads a JSON file which contains polygon coordinates, and converts them into a list of NumPy...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
examples/traffic_analysis/ultralytics_example.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.215048
from __future__ import annotations from collections.abc import Iterable import cv2 import numpy as np from tqdm import tqdm from ultralytics import YOLO import supervision as sv COLORS = sv.ColorPalette.from_hex(["#E6194B", "#3CB44B", "#FFE119", "#3C76D1"]) ZONE_IN_POLYGONS = [ np.array([[592, 282], [900, 282]...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.300624
import importlib.metadata as importlib_metadata try: # This will read version from pyproject.toml __version__ = importlib_metadata.version(__package__ or __name__) except importlib_metadata.PackageNotFoundError: __version__ = "development" from supervision.annotators.core import ( BackgroundOverlayAnn...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/annotators/utils.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.642819
from __future__ import annotations import re import textwrap from enum import Enum from typing import Any import numpy as np import numpy.typing as npt from supervision.config import CLASS_NAME_DATA_FIELD from supervision.detection.core import Detections from supervision.draw.color import Color, ColorPalette from su...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/annotators/base.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.670786
from abc import ABC, abstractmethod from typing import Any from supervision.detection.core import Detections class BaseAnnotator(ABC): @abstractmethod def annotate( self, scene: Any, detections: Detections, *args: Any, **kwargs: Any ) -> Any: pass
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/assets/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.773059
from supervision.assets.downloader import download_assets from supervision.assets.list import ImageAssets, VideoAssets __all__ = ["ImageAssets", "VideoAssets", "download_assets"]
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/assets/list.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.803613
from enum import Enum BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/" BASE_IMAGE_URL = "https://media.roboflow.com/supervision/image-examples/" class Assets(Enum): filename: str md5_hash: str def __new__(cls, filename: str, md5_hash: str) -> "Assets": obj = object.__new...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/classification/core.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.880490
from __future__ import annotations from dataclasses import dataclass from typing import TYPE_CHECKING, Any import numpy as np import numpy.typing as npt if TYPE_CHECKING: import torch def _validate_class_ids(class_id: Any, n: int) -> None: """ Ensure that class_id is a 1d np.ndarray with (n, ) shape. ...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/dataset/core.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.884889
from __future__ import annotations import os from abc import ABC, abstractmethod from collections.abc import Iterator from dataclasses import dataclass from itertools import chain from pathlib import Path import cv2 import numpy as np import numpy.typing as npt from supervision.classification.core import Classificat...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/assets/downloader.py
null
null
null
null
null
null
Python
2026-05-04T02:21:42.915828
from __future__ import annotations import os from hashlib import md5 from pathlib import Path from shutil import copyfileobj from requests import get from tqdm.auto import tqdm from supervision.assets.list import MEDIA_ASSETS, Assets from supervision.utils.logger import _get_logger logger = _get_logger(__name__) ...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/dataset/formats/coco.py
null
null
null
null
null
null
Python
2026-05-04T02:21:43.250062
import warnings from datetime import datetime from pathlib import Path from typing import TYPE_CHECKING, Any, Union, cast import numpy as np import numpy.typing as npt from supervision.dataset.utils import ( approximate_mask_with_polygons, map_detections_class_id, ) from supervision.detection.core import Dete...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/dataset/formats/pascal_voc.py
null
null
null
null
null
null
Python
2026-05-04T02:21:43.354071
from __future__ import annotations import os from pathlib import Path from xml.etree.ElementTree import Element, SubElement import cv2 import numpy as np import numpy.typing as npt from defusedxml.ElementTree import parse, tostring from defusedxml.minidom import parseString from supervision.dataset.utils import appr...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/dataset/utils.py
null
null
null
null
null
null
Python
2026-05-04T02:21:43.401010
from __future__ import annotations import copy import os import random import shutil from pathlib import Path from typing import TYPE_CHECKING, Any, TypeVar import cv2 import numpy as np import numpy.typing as npt from deprecate import deprecated, void from supervision.detection.core import Detections from supervisi...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/dataset/formats/yolo.py
null
null
null
null
null
null
Python
2026-05-04T02:21:43.426057
from __future__ import annotations import os import warnings from pathlib import Path from typing import TYPE_CHECKING, Any import numpy as np import numpy.typing as npt from PIL import Image from supervision.config import ORIENTED_BOX_COORDINATES from supervision.dataset.utils import approximate_mask_with_polygons ...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/detection/compact_mask.py
null
null
null
null
null
null
Python
2026-05-04T02:21:43.473434
"""Crop-RLE compact mask storage for memory-efficient instance segmentation. Dense ``(N, H, W)`` boolean masks use O(N·H·W) memory, which becomes prohibitive for aerial imagery (e.g. 1000 objects x 4K image ~ 8.3 GB). :class:`CompactMask` stores each mask as a run-length encoding of its bounding-box crop, reducing typ...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/detection/line_zone.py
null
null
null
null
null
null
Python
2026-05-04T02:21:43.513770
from __future__ import annotations import math import warnings from collections import Counter, defaultdict, deque from collections.abc import Iterable from functools import lru_cache from typing import Any, Literal, cast import cv2 import numpy as np import numpy.typing as npt from supervision.config import CLASS_N...
roboflow/supervision
https://github.com/roboflow/supervision
null
null
null
null
38,300
null
null
mit
null
null
null
null
null
null
null
src/supervision/detection/core.py
null
null
null
null
null
null
Python
2026-05-04T02:21:43.672271
from __future__ import annotations from collections.abc import Iterator from dataclasses import dataclass, field from functools import reduce from typing import Any, cast import numpy as np import numpy.typing as npt from supervision.config import ( CLASS_NAME_DATA_FIELD, ORIENTED_BOX_COORDINATES, ) from sup...