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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MakotoKurauchi/helix | https://github.com/MakotoKurauchi/helix | null | null | null | null | 977 | null | null | mit | null | null | null | null | null | null | null | FontConverter/img2hex.py | null | null | null | null | null | null | Python | 2026-05-04T01:36:53.488449 | # Image to Hex Converter
# Copyright (c) 2018 MakotoKurauchi
# MIT License
from PIL import Image
from numpy import *
import sys
argvs = sys.argv
argc = len(argvs)
if (argc != 2):
print ('Usage: $ python %s filename' % argvs[0])
quit()
im = array(Image.open(argvs[1]).rotate(-90, expand=True))
#print (im)
fontw =... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | dropbox/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:36:56.291219 | from __future__ import absolute_import
from dropbox.dropbox_client import ( # noqa: F401 # pylint: disable=unused-import
__version__, Dropbox, DropboxTeam, create_session
)
from dropbox.oauth import ( # noqa: F401 # pylint: disable=unused-import
DropboxOAuth2Flow, DropboxOAuth2FlowNoRedirect
)
|
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | dropbox/dropbox_client.py | null | null | null | null | null | null | Python | 2026-05-04T01:36:58.197071 | __all__ = [
'Dropbox',
'DropboxTeam',
'create_session',
]
# This should always be 0.0.0 in main. Only update this after tagging
# before release.
__version__ = '0.0.0'
import base64
import contextlib
import json
import logging
import random
import time
import requests
import six
from datetime import dat... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | dropbox/session.py | null | null | null | null | null | null | Python | 2026-05-04T01:36:58.536799 | import os
import ssl
import requests
from requests.adapters import HTTPAdapter
from urllib3.poolmanager import PoolManager
API_DOMAIN = os.environ.get('DROPBOX_API_DOMAIN',
os.environ.get('DROPBOX_DOMAIN', '.dropboxapi.com'))
WEB_DOMAIN = os.environ.get('DROPBOX_WEB_DOMAIN',
os.environ.get('DROPBOX_DOMAIN', ... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | example/oauth/commandline-oauth.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:00.573936 | #!/usr/bin/env python3
import dropbox
from dropbox import DropboxOAuth2FlowNoRedirect
'''
This example walks through a basic oauth flow using the existing long-lived token type
Populate your app key and app secret in order to run this locally
'''
APP_KEY = ""
APP_SECRET = ""
auth_flow = DropboxOAuth2FlowNoRedirect(A... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | dropbox/exceptions.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:00.679445 | class DropboxException(Exception):
"""All errors related to making an API request extend this."""
def __init__(self, request_id, *args, **kwargs):
# A request_id can be shared with Dropbox Support to pinpoint the exact
# request that returns an error.
super(DropboxException, self).__ini... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | example/oauth/commandline-oauth-scopes.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:00.953319 | #!/usr/bin/env python3
import dropbox
from dropbox import DropboxOAuth2FlowNoRedirect
'''
It goes through an example of requesting a starting scope,
and requesting more throughout the process
'''
APP_KEY = ""
APP_SECRET = ""
auth_flow = DropboxOAuth2FlowNoRedirect(APP_KEY,
con... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | example/updown.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:00.988912 | """Upload the contents of your Downloads folder to Dropbox.
This is an example app for API v2.
"""
from __future__ import print_function
import argparse
import contextlib
import datetime
import os
import six
import sys
import time
import unicodedata
if sys.version.startswith('2'):
input = raw_input # noqa: E50... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | ez_setup.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:01.167940 | #!/usr/bin/env python
"""Bootstrap setuptools installation
To use setuptools in your package's setup.py, include this
file in the same directory and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
To require a specific version of setuptools, set a download
mirror, ... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | example/oauth/commandline-oauth-pkce.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:01.215298 | #!/usr/bin/env python3
import dropbox
from dropbox import DropboxOAuth2FlowNoRedirect
'''
Populate your app key in order to run this locally
'''
APP_KEY = ""
auth_flow = DropboxOAuth2FlowNoRedirect(APP_KEY, use_pkce=True, token_access_type='offline')
authorize_url = auth_flow.start()
print("1. Go to: " + authorize_... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | example/back-up-and-restore/backup-and-restore-example.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:01.233893 | """
Backs up and restores a settings file to Dropbox.
This is an example app for API v2.
"""
import sys
import dropbox
from dropbox.files import WriteMode
from dropbox.exceptions import ApiError, AuthError
# Add OAuth2 access token here.
# You can generate one for yourself in the App Console.
# See <https://blogs.dro... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | generate_base_client.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:01.238947 | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import glob
import os
import subprocess
import sys
cmdline_desc = """\
Runs Stone to generate Python types and client for the Dropbox client.
"""
_cmdline_parser = argparse.ArgumentParser(descrip... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | setup.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:01.541239 | # Don't import unicode_literals because of a bug in py2 setuptools
# where package_data is expected to be str and not unicode.
from __future__ import absolute_import, division, print_function
import codecs
import os
import sys
# Ensure setuptools is available
try:
from ez_setup import use_setuptools
use_setup... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | test/integration/test_dropbox.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:01.547720 | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, unicode_literals
import datetime
import os
import random
import re
import string
import sys
import pytest
try:
from io import BytesIO
except ImportError:
from StringIO import StringIO as BytesIO
from dropbox import (
... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | test/unit/test_dropbox_unit.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:01.807397 | #!/usr/bin/env python
import mock
import pickle
import pytest
# Tests OAuth Flow
from dropbox import DropboxOAuth2Flow, session, Dropbox, create_session
from dropbox.dropbox_client import BadInputException, DropboxTeam
from dropbox.exceptions import AuthError
from dropbox.oauth import OAuth2FlowNoRedirectResult, Dro... |
dropbox/dropbox-sdk-python | https://github.com/dropbox/dropbox-sdk-python | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | dropbox/oauth.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:03.218460 | import hashlib
__all__ = [
'BadRequestException',
'BadStateException',
'CsrfException',
'DropboxOAuth2Flow',
'DropboxOAuth2FlowNoRedirect',
'NotApprovedException',
'OAuth2FlowNoRedirectResult',
'OAuth2FlowResult',
'ProviderException',
]
import base64
import os
import six
import url... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/alignment/convert_98_to_68_landmarks.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:05.425579 | import numpy as np
def load_txt_file(file_path):
"""Load data or string from txt file."""
with open(file_path, 'r') as cfile:
content = cfile.readlines()
cfile.close()
content = [x.strip() for x in content]
num_lines = len(content)
return content, num_lines
def anno_parser(anno_path... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/detection/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:05.427282 | import torch
from copy import deepcopy
from facexlib.utils import load_file_from_url
from .retinaface import RetinaFace
def init_detection_model(model_name, half=False, device='cuda', model_rootpath=None):
if model_name == 'retinaface_resnet50':
model = RetinaFace(network_name='resnet50', half=half, devi... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/alignment/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:05.427850 | import torch
from facexlib.utils import load_file_from_url
from .awing_arch import FAN
from .convert_98_to_68_landmarks import landmark_98_to_68
__all__ = ['FAN', 'landmark_98_to_68']
def init_alignment_model(model_name, half=False, device='cuda', model_rootpath=None):
if model_name == 'awing_fan':
mode... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/assessment/hyperiqa_net.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:05.430112 | import torch as torch
import torch.nn as nn
from torch.nn import functional as F
class HyperIQA(nn.Module):
"""
Combine the hypernet and target network within a network.
"""
def __init__(self, *args):
super(HyperIQA, self).__init__()
self.hypernet = HyperNet(*args)
def forward(se... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/detection/align_trans.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:05.444292 | import cv2
import numpy as np
from .matlab_cp2tform import get_similarity_transform_for_cv2
# reference facial points, a list of coordinates (x,y)
REFERENCE_FACIAL_POINTS = [[30.29459953, 51.69630051], [65.53179932, 51.50139999], [48.02519989, 71.73660278],
[33.54930115, 92.3655014], [62.72... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:05.445461 | # flake8: noqa
from .alignment import *
from .detection import *
from .recognition import *
from .tracking import *
from .utils import *
from .version import __gitsha__, __version__
from .visualization import *
|
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/detection/retinaface.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:05.455419 | import cv2
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from PIL import Image
from torchvision.models._utils import IntermediateLayerGetter as IntermediateLayerGetter
from facexlib.detection.align_trans import get_reference_facial_points, warp_and_crop_face
from facexlib.detect... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/alignment/awing_arch.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:05.517619 | import cv2
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
def calculate_points(heatmaps):
# change heatmaps to landmarks
B, N, H, W = heatmaps.shape
HW = H * W
BN_range = np.arange(B * N)
heatline = heatmaps.reshape(B, N, HW)
indexes = np.argmax(heatline... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/assessment/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:05.539695 | import torch
from facexlib.utils import load_file_from_url
from .hyperiqa_net import HyperIQA
def init_assessment_model(model_name, half=False, device='cuda', model_rootpath=None):
if model_name == 'hypernet':
model = HyperIQA(16, 112, 224, 112, 56, 28, 14, 7)
model_url = 'https://github.com/xinn... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/detection/matlab_cp2tform.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:05.540911 | import numpy as np
from numpy.linalg import inv, lstsq
from numpy.linalg import matrix_rank as rank
from numpy.linalg import norm
class MatlabCp2tormException(Exception):
def __str__(self):
return 'In File {}:{}'.format(__file__, super.__str__(self))
def tformfwd(trans, uv):
"""
Function:
-... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/detection/retinaface_net.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.033531 | import torch
import torch.nn as nn
import torch.nn.functional as F
def conv_bn(inp, oup, stride=1, leaky=0):
return nn.Sequential(
nn.Conv2d(inp, oup, 3, stride, 1, bias=False), nn.BatchNorm2d(oup),
nn.LeakyReLU(negative_slope=leaky, inplace=True))
def conv_bn_no_relu(inp, oup, stride):
retu... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/matting/backbone.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.050453 | import os
import torch
import torch.nn as nn
from .mobilenetv2 import MobileNetV2
class BaseBackbone(nn.Module):
""" Superclass of Replaceable Backbone Model for Semantic Estimation
"""
def __init__(self, in_channels):
super(BaseBackbone, self).__init__()
self.in_channels = in_channels
... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/detection/retinaface_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.054928 | import numpy as np
import torch
import torchvision
from itertools import product as product
from math import ceil
class PriorBox(object):
def __init__(self, cfg, image_size=None, phase='train'):
super(PriorBox, self).__init__()
self.min_sizes = cfg['min_sizes']
self.steps = cfg['steps']
... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/matting/mobilenetv2.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.055495 | """ This file is adapted from https://github.com/thuyngch/Human-Segmentation-PyTorch"""
import math
import torch
from torch import nn
# ------------------------------------------------------------------------------
# Useful functions
# ------------------------------------------------------------------------------
... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/headpose/hopenet_arch.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.068513 | import torch
import torch.nn as nn
import torchvision
class HopeNet(nn.Module):
# Hopenet with 3 output layers for yaw, pitch and roll
# Predicts Euler angles by binning and regression with the expected value
def __init__(self, block, layers, num_bins):
super(HopeNet, self).__init__()
if b... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/matting/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.069051 | import torch
from copy import deepcopy
from facexlib.utils import load_file_from_url
from .modnet import MODNet
def init_matting_model(model_name='modnet', half=False, device='cuda', model_rootpath=None):
if model_name == 'modnet':
model = MODNet(backbone_pretrained=False)
model_url = 'https://gi... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/matting/modnet.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.103651 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .backbone import MobileNetV2Backbone
# ------------------------------------------------------------------------------
# MODNet Basic Modules
# ------------------------------------------------------------------------------
class IBNorm(nn.Modul... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/parsing/bisenet.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.163315 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .resnet import ResNet18
class ConvBNReLU(nn.Module):
def __init__(self, in_chan, out_chan, ks=3, stride=1, padding=1):
super(ConvBNReLU, self).__init__()
self.conv = nn.Conv2d(in_chan, out_chan, kernel_size=ks, stride=stride... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/headpose/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.164586 | import torch
from facexlib.utils import load_file_from_url
from .hopenet_arch import HopeNet
def init_headpose_model(model_name, half=False, device='cuda', model_rootpath=None):
if model_name == 'hopenet':
model = HopeNet('resnet', [3, 4, 6, 3], 66)
model_url = 'https://github.com/xinntao/facexli... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/parsing/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.169177 | import torch
from facexlib.utils import load_file_from_url
from .bisenet import BiSeNet
from .parsenet import ParseNet
def init_parsing_model(model_name='bisenet', half=False, device='cuda', model_rootpath=None):
if model_name == 'bisenet':
model = BiSeNet(num_class=19)
model_url = 'https://githu... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/parsing/parsenet.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.649779 | """Modified from https://github.com/chaofengc/PSFRGAN
"""
import numpy as np
import torch.nn as nn
from torch.nn import functional as F
class NormLayer(nn.Module):
"""Normalization Layers.
Args:
channels: input channels, for batch norm and instance norm.
input_size: input shape without batch ... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/recognition/arcface_arch.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.655134 | import torch
from collections import namedtuple
from torch.nn import (AdaptiveAvgPool2d, BatchNorm1d, BatchNorm2d, Conv2d, Dropout, Linear, MaxPool2d, Module, PReLU,
ReLU, Sequential, Sigmoid)
# Original Arcface Model
class Flatten(Module):
def forward(self, input):
return input.vi... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/tracking/data_association.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.673039 | """
For each detected item, it computes the intersection over union (IOU) w.r.t.
each tracked object. (IOU matrix)
Then, it applies the Hungarian algorithm (via linear_assignment) to assign each
det. item to the best possible tracked item (i.e. to the one with max IOU)
"""
import numpy as np
from numba import jit
from... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/utils/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.738685 | from .face_utils import align_crop_face_landmarks, compute_increased_bbox, get_valid_bboxes, paste_face_back
from .misc import img2tensor, load_file_from_url, scandir
__all__ = [
'align_crop_face_landmarks', 'compute_increased_bbox', 'get_valid_bboxes', 'load_file_from_url', 'paste_face_back',
'img2tensor', 's... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/tracking/kalman_tracker.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.740375 | import numpy as np
from filterpy.kalman import KalmanFilter
def convert_bbox_to_z(bbox):
"""Takes a bounding box in the form [x1,y1,x2,y2] and returns z in the form
[x,y,s,r] where x,y is the centre of the box and s is the scale/area and
r is the aspect ratio
"""
w = bbox[2] - bbox[0]
h = bbox... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/parsing/resnet.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.741592 | import torch.nn as nn
import torch.nn.functional as F
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False)
class BasicBlock(nn.Module):
def __init__(self, in_chan, out_chan, stride=1... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/utils/face_restoration_helper.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.761828 | import cv2
import numpy as np
import os
import torch
from torchvision.transforms.functional import normalize
from facexlib.detection import init_detection_model
from facexlib.parsing import init_parsing_model
from facexlib.utils.misc import img2tensor, imwrite
def get_largest_face(det_faces, h, w):
def get_loca... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/recognition/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.781239 | import torch
from facexlib.utils import load_file_from_url
from .arcface_arch import Backbone
def init_recognition_model(model_name, half=False, device='cuda', model_rootpath=None):
if model_name == 'arcface':
model = Backbone(num_layers=50, drop_ratio=0.6, mode='ir_se').to('cuda').eval()
model_u... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/tracking/sort.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:06.804343 | import numpy as np
from facexlib.tracking.data_association import associate_detections_to_trackers
from facexlib.tracking.kalman_tracker import KalmanBoxTracker
class SORT(object):
"""SORT: A Simple, Online and Realtime Tracker.
Ref: https://github.com/abewley/sort
"""
def __init__(self, max_age=1,... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/utils/face_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:07.562037 | import cv2
import numpy as np
import torch
def compute_increased_bbox(bbox, increase_area, preserve_aspect=True):
left, top, right, bot = bbox
width = right - left
height = bot - top
if preserve_aspect:
width_increase = max(increase_area, ((1 + 2 * increase_area) * height - width) / (2 * widt... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/visualization/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:07.643139 | from .vis_alignment import visualize_alignment
from .vis_detection import visualize_detection
from .vis_headpose import visualize_headpose
__all__ = ['visualize_detection', 'visualize_alignment', 'visualize_headpose']
|
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/utils/misc.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:07.644465 | import cv2
import os
import os.path as osp
import torch
from torch.hub import download_url_to_file, get_dir
from urllib.parse import urlparse
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
def imwrite(img, file_path, params=None, auto_mkdir=True):
"""Write image to file.
... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/visualization/vis_alignment.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:07.672274 | import cv2
import numpy as np
def visualize_alignment(img, landmarks, save_path=None, to_bgr=False):
img = np.copy(img)
h, w = img.shape[0:2]
circle_size = int(max(h, w) / 150)
if to_bgr:
img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
for landmarks_face in landmarks:
for lm in landmar... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | inference/inference_detection.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:07.954626 | import argparse
import cv2
import torch
from facexlib.detection import init_detection_model
from facexlib.visualization import visualize_detection
def main(args):
# initialize model
det_net = init_detection_model(args.model_name, half=args.half)
img = cv2.imread(args.img_path)
with torch.no_grad():
... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | inference/inference_hyperiqa.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.232460 | import argparse
import cv2
import numpy as np
import os
import torch
import torchvision
from PIL import Image
from facexlib.assessment import init_assessment_model
from facexlib.detection import init_detection_model
def main(args):
"""Scripts about evaluating face quality.
Two steps:
1) detect th... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | inference/inference_parsing.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.250814 | import argparse
import cv2
import numpy as np
import os
import torch
from torchvision.transforms.functional import normalize
from facexlib.parsing import init_parsing_model
from facexlib.utils.misc import img2tensor
def vis_parsing_maps(img, parsing_anno, stride, save_anno_path=None, save_vis_path=None):
# Color... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | inference/inference_matting.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.253368 | import argparse
import cv2
import numpy as np
import torch.nn.functional as F
from torchvision.transforms.functional import normalize
from facexlib.matting import init_matting_model
from facexlib.utils import img2tensor
def main(args):
modnet = init_matting_model()
# read image
img = cv2.imread(args.img... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | inference/inference_parsing_parsenet.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.296791 | import argparse
import cv2
import numpy as np
import os
import torch
from torchvision.transforms.functional import normalize
from facexlib.parsing import init_parsing_model
from facexlib.utils.misc import img2tensor
def vis_parsing_maps(img, parsing_anno, stride, save_anno_path=None, save_vis_path=None):
# Color... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | inference/inference_crop_standard_faces.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.362828 | import cv2
import torch
from facexlib.detection import init_detection_model
from facexlib.utils.face_restoration_helper import FaceRestoreHelper
input_img = '/home/wxt/datasets/ffhq/ffhq_wild/00028.png'
# initialize face helper
face_helper = FaceRestoreHelper(
upscale_factor=1, face_size=512, crop_ratio=(1, 1), d... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/visualization/vis_headpose.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.456506 | import cv2
import numpy as np
from math import cos, sin
def draw_axis(img, yaw, pitch, roll, tdx=None, tdy=None, size=100):
"""draw head pose axis."""
pitch = pitch * np.pi / 180
yaw = -yaw * np.pi / 180
roll = roll * np.pi / 180
if tdx is None or tdy is None:
height, width = img.shape[:... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | inference/inference_alignment.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.508928 | import argparse
import cv2
import torch
from facexlib.alignment import init_alignment_model, landmark_98_to_68
from facexlib.visualization import visualize_alignment
def main(args):
# initialize model
align_net = init_alignment_model(args.model_name, device=args.device)
img = cv2.imread(args.img_path)
... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | facexlib/visualization/vis_detection.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.528742 | import cv2
import numpy as np
def visualize_detection(img, bboxes_and_landmarks, save_path=None, to_bgr=False):
"""Visualize detection results.
Args:
img (Numpy array): Input image. CHW, BGR, [0, 255], uint8.
"""
img = np.copy(img)
if to_bgr:
img = cv2.cvtColor(img, cv2.COLOR_RGB2... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | inference/inference_recognition.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.546871 | import argparse
import glob
import math
import numpy as np
import os
import torch
from facexlib.recognition import ResNetArcFace, cosin_metric, load_image
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--folder1', type=str)
parser.add_argument('--folder2', type=str)
... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | inference/inference_headpose.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.568914 | import argparse
import cv2
import numpy as np
import torch
from torchvision.transforms.functional import normalize
from facexlib.detection import init_detection_model
from facexlib.headpose import init_headpose_model
from facexlib.utils.misc import img2tensor
from facexlib.visualization import visualize_headpose
def... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | scripts/extract_detection_info_ffhq.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.833003 | import cv2
import glob
import numpy as np
import os
import torch
from PIL import Image
from tqdm import tqdm
from facexlib.detection import init_detection_model
def draw_and_save(image, bboxes_and_landmarks, save_path, order_type=1):
"""Visualize results
"""
if isinstance(image, Image.Image):
ima... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | scripts/crop_faces_5landmarks.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.839656 | import glob
import os
import facexlib.utils.face_restoration_helper as face_restoration_helper
def crop_one_img(img, save_cropped_path=None):
FaceRestoreHelper.clean_all()
FaceRestoreHelper.read_image(img)
# get face landmarks
FaceRestoreHelper.get_face_landmarks_5()
FaceRestoreHelper.align_warp_... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | inference/inference_tracking.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.840278 | import argparse
import cv2
import glob
import numpy as np
import os
import torch
from tqdm import tqdm
from facexlib.detection import init_detection_model
from facexlib.tracking.sort import SORT
def main(args):
detect_interval = args.detect_interval
margin = args.margin
face_score_threshold = args.face_s... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | scripts/get_ffhq_template.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.873276 | import cv2
import numpy as np
from PIL import Image
bboxes = np.load('ffhq_det_info.npy', allow_pickle=True)
bboxes = np.array(bboxes).squeeze(1)
bboxes = np.mean(bboxes, axis=0)
print(bboxes)
def draw_and_save(image, bboxes_and_landmarks, save_path, order_type=1):
"""Visualize results
"""
if isinstan... |
xinntao/facexlib | https://github.com/xinntao/facexlib | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | setup.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:08.945870 | #!/usr/bin/env python
from setuptools import find_packages, setup
import os
import subprocess
import time
version_file = 'facexlib/version.py'
def readme():
with open('README.md', encoding='utf-8') as f:
content = f.read()
return content
def get_git_hash():
def _minimal_ext_cmd(cmd):
... |
kennethleungty/Llama-2-Open-Source-LLM-CPU-Inference | https://github.com/kennethleungty/Llama-2-Open-Source-LLM-CPU-Inference | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | main.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:11.025581 | import box
import timeit
import yaml
import argparse
from dotenv import find_dotenv, load_dotenv
from src.utils import setup_dbqa
# Load environment variables from .env file
load_dotenv(find_dotenv())
# Import config vars
with open('config/config.yml', 'r', encoding='utf8') as ymlfile:
cfg = box.Box(yaml.safe_loa... |
kennethleungty/Llama-2-Open-Source-LLM-CPU-Inference | https://github.com/kennethleungty/Llama-2-Open-Source-LLM-CPU-Inference | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | src/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:11.048872 | '''
===========================================
Module: Util functions
===========================================
'''
import box
import yaml
from langchain import PromptTemplate
from langchain.chains import RetrievalQA
from langchain.embeddings import HuggingFaceEmbeddings
from langchain.vectorstores import F... |
kennethleungty/Llama-2-Open-Source-LLM-CPU-Inference | https://github.com/kennethleungty/Llama-2-Open-Source-LLM-CPU-Inference | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | db_build.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:11.080672 | # =========================
# Module: Vector DB Build
# =========================
import box
import yaml
from langchain.vectorstores import FAISS
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.document_loaders import PyPDFLoader, DirectoryLoader
from langchain.embeddings import Huggi... |
kennethleungty/Llama-2-Open-Source-LLM-CPU-Inference | https://github.com/kennethleungty/Llama-2-Open-Source-LLM-CPU-Inference | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | src/llm.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:11.135266 | '''
===========================================
Module: Open-source LLM Setup
===========================================
'''
from langchain.llms import CTransformers
from dotenv import find_dotenv, load_dotenv
import box
import yaml
# Load environment variables from .env file
load_dotenv(find_dotenv())
# Imp... |
kennethleungty/Llama-2-Open-Source-LLM-CPU-Inference | https://github.com/kennethleungty/Llama-2-Open-Source-LLM-CPU-Inference | null | null | null | null | 976 | null | null | mit | null | null | null | null | null | null | null | src/prompts.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:11.160823 | '''
===========================================
Module: Prompts collection
===========================================
'''
# Note: Precise formatting of spacing and indentation of the prompt template is important for Llama-2-7B-Chat,
# as it is highly sensitive to whitespace changes. For example, it could have ... |
tarpas/pytest-testmon | https://github.com/tarpas/pytest-testmon | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | testmon/common.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:13.220212 | import logging
import os
import re
try:
# Python >= 3.8
import importlib.metadata
def get_system_packages_raw():
return (
(pkg.metadata["Name"], pkg.version)
for pkg in importlib.metadata.distributions()
)
except ImportError:
# Python < 3.7
import pkg_resou... |
tarpas/pytest-testmon | https://github.com/tarpas/pytest-testmon | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | testmon/db.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:13.220995 | import json
import os
import sqlite3
from collections import namedtuple
from functools import lru_cache
from testmon.process_code import blob_to_checksums, checksums_to_blob
from testmon.common import TestExecutions
DATA_VERSION = 14
ChangedFileData = namedtuple(
"ChangedFileData", "filename name method_check... |
tarpas/pytest-testmon | https://github.com/tarpas/pytest-testmon | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | testmon/configure.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:13.241281 | import sys
import re
try:
from coverage.tracer import CTracer as Tracer # pylint: disable=no-name-in-module
except ImportError:
from coverage.pytracer import PyTracer as Tracer
from dataclasses import dataclass
def _is_dogfooding(coverage_stack):
return coverage_stack
def _is_debugger():
return s... |
tarpas/pytest-testmon | https://github.com/tarpas/pytest-testmon | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | testmon/process_code.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:13.247639 | import ast
import textwrap
import zlib
from functools import lru_cache
import sqlite3
import hashlib
from pathlib import Path
from typing import Optional, Union
from array import array
from subprocess import run, CalledProcessError
from coverage.phystokens import source_encoding
CHECKUMS_ARRAY_TYPE = "i"
def to_sig... |
tarpas/pytest-testmon | https://github.com/tarpas/pytest-testmon | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | testmon/pytest_testmon.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:13.248077 | # -*- coding: utf-8 -*-
"""
Main module of testmon pytest plugin.
"""
import time
import xmlrpc.client
import os
from collections import defaultdict
from datetime import date, timedelta
from pathlib import Path
import pytest
from _pytest.config import ExitCode, Config
from _pytest.terminal import TerminalReporter
f... |
tarpas/pytest-testmon | https://github.com/tarpas/pytest-testmon | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | tests/test_process_code.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:13.274895 | # -- coding:utf8 --
from pathlib import Path
from subprocess import run
import pytest
from testmon.process_code import (
Module,
read_source_sha,
match_fingerprint_source,
create_fingerprint_source,
get_source_sha,
noncached_get_files_shas,
)
from testmon.testmon_core import SourceTree
try:
... |
tarpas/pytest-testmon | https://github.com/tarpas/pytest-testmon | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | testmon/testmon_core.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:13.308199 | import hashlib
import os
import random
import sys
import sysconfig
import textwrap
from functools import lru_cache
from collections import defaultdict
from xmlrpc.client import Fault, ProtocolError
from socket import gaierror
from typing import TypeVar
try:
from pytest_cov.plugin import CovPlugin
except ImportErr... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:15.463651 | from .models import available_model_ids, available_model_ids_and_names, get_model_description, load
|
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/llm/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:15.468512 | from .base_llm import LLMBackbone
from .llama2 import LLaMa2LLMBackbone
from .mistral import MistralLLMBackbone
from .phi import PhiLLMBackbone
|
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/conf/datasets.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:15.472287 | """
datasets.py
Draccus Dataclass Definition for a DatasetConfig object, with various registered subclasses for each dataset variant
and processing scheme. A given dataset variant (e.g., `llava-lightning`) configures the following attributes:
- Dataset Variant (Identifier) --> e.g., "llava-v15"
- Align Stage D... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/llm/base_llm.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:15.474041 | """
base_llm.py
Abstract class definition of a large (autoregressive) language model backbone (LLM), with full annotations of class
methods, utility functions, and initialization logic.
We also define the generic HFLLMBackbone class here, providing a default interface for loading any HF
AutoModelForCausalLM (e.g., LL... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/llm/llama2.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:15.476210 | """
llama2.py
Class definition for all LLMs derived from LlamaForCausalLM.
"""
from typing import Optional, Type
import torch
from torch import nn as nn
from transformers import LlamaForCausalLM
from transformers.models.llama.modeling_llama import LlamaDecoderLayer
from prismatic.models.backbones.llm.base_llm impor... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/conf/models.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:15.481626 | """
models.py
Draccus Dataclass Definition for a ModelConfig object, with various registered subclasses for each model family and
variant thereof. A given model variant configures the following attributes:
- Pretrained Visual Representation (e.g., OpenAI CLIP ViT-L/14) + Pretrained LLM Backbone (e.g., LLaMa-2 7B)
... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/conf/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:15.496548 | from .datasets import DatasetConfig, DatasetRegistry
from .models import ModelConfig, ModelRegistry
|
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/llm/mistral.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:15.528496 | """
mistral.py
Class definition for all LLMs derived from MistralForCausalLM.
"""
from typing import Optional, Type
import torch
from torch import nn as nn
from transformers import MistralForCausalLM
from transformers.models.mistral.modeling_mistral import MistralDecoderLayer
from prismatic.models.backbones.llm.bas... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:15.576209 | from .load import available_model_ids, available_model_ids_and_names, get_model_description, load
from .materialize import get_llm_backbone_and_tokenizer, get_vision_backbone_and_transform, get_vlm
|
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/llm/prompting/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.068898 | from .base_prompter import PromptBuilder, PurePromptBuilder
from .llama2_chat_prompter import LLaMa2ChatPromptBuilder
from .mistral_instruct_prompter import MistralInstructPromptBuilder
from .phi_prompter import PhiPromptBuilder
from .vicuna_v15_prompter import VicunaV15ChatPromptBuilder
|
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/llm/phi.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.101207 | """
phi.py
Class definition for all LLMs derived from PhiForCausalLM.
"""
from typing import Optional, Type
import torch
from torch import nn as nn
from transformers import PhiForCausalLM
from transformers.models.phi.modeling_phi import PhiDecoderLayer
from prismatic.models.backbones.llm.base_llm import HFCausalLLM... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/llm/prompting/mistral_instruct_prompter.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.115019 | """
mistral_instruct_prompter.py
Defines a PromptBuilder for building Mistral Instruct Chat Prompts --> recommended pattern used by HF / tutorials.
Reference: https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1#instruction-format
"""
from typing import Optional
from prismatic.models.backbones.llm.prompting.ba... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/vision/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.120225 | from .base_vision import ImageTransform, VisionBackbone
from .clip_vit import CLIPViTBackbone
from .dinoclip_vit import DinoCLIPViTBackbone
from .dinosiglip_vit import DinoSigLIPViTBackbone
from .dinov2_vit import DinoV2ViTBackbone
from .in1k_vit import IN1KViTBackbone
from .siglip_vit import SigLIPViTBackbone
|
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/llm/prompting/phi_prompter.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.123424 | """
phi_prompter.py
Defines a PromptBuilder for building Phi-2 Input/Output Prompts --> recommended pattern used by HF / Microsoft.
Also handles Phi special case BOS token additions.
Reference: https://huggingface.co/microsoft/phi-2#qa-format
"""
from typing import Optional
from prismatic.models.backbones.llm.promp... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/llm/prompting/base_prompter.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.124919 | """
base_prompter.py
Abstract class definition of a multi-turn prompt builder for ensuring consistent formatting for chat-based LLMs.
"""
from abc import ABC, abstractmethod
from typing import Optional
class PromptBuilder(ABC):
def __init__(self, model_family: str, system_prompt: Optional[str] = None) -> None:
... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/llm/prompting/vicuna_v15_prompter.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.137268 | """
vicuna_v15_prompter.py
Defines a PromptBuilder for building Vicuna-v1.5 Chat Prompts.
Reference: https://huggingface.co/lmsys/vicuna-13b-v1.5
"""
from typing import Optional
from prismatic.models.backbones.llm.prompting.base_prompter import PromptBuilder
# Default System Prompt for LLaVa Models
SYS_PROMPTS = {... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/vision/clip_vit.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.146701 | """
clip_vit.py
"""
from prismatic.models.backbones.vision.base_vision import TimmViTBackbone
# Registry =>> Supported CLIP Vision Backbones (from TIMM)
CLIP_VISION_BACKBONES = {
"clip-vit-b": "vit_base_patch16_clip_224.openai",
"clip-vit-l": "vit_large_patch14_clip_224.openai",
"clip-vit-l-336px": "vit_l... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/llm/prompting/llama2_chat_prompter.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.147816 | """
llama2_prompter.py
Defines a PromptBuilder for building LLaMa-2 Chat Prompts --> not sure if this is "optimal", but this is the pattern
that's used by HF and other online tutorials.
Reference: https://huggingface.co/blog/llama2#how-to-prompt-llama-2
"""
from typing import Optional
from prismatic.models.backbone... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/vision/base_vision.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.175742 | """
base_vision.py
Abstract class definition of a Vision Backbone (Visual Featurizer), with full annotations of class methods, utility
functions, and initialization logic.
We also define the generic TimmViTBackbone class here, providing a default interface for loading any TIMM Vision
Transformer model for feature ext... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/vision/dinoclip_vit.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.667051 | """
dinoclip_vit.py
Vision backbone that returns concatenated features from both DINOv2 and CLIP.
"""
from dataclasses import dataclass
from functools import partial
from typing import Callable, Dict, Tuple
import timm
import torch
from PIL import Image
from timm.models.vision_transformer import Block, VisionTransfo... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/vision/in1k_vit.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.715320 | """
in1k_vit.py
Vision Transformers trained / finetuned on ImageNet (ImageNet-21K =>> ImageNet-1K)
"""
from prismatic.models.backbones.vision.base_vision import TimmViTBackbone
# Registry =>> Supported Vision Backbones (from TIMM)
IN1K_VISION_BACKBONES = {
"in1k-vit-l": "vit_large_patch16_224.augreg_in21k_ft_in1... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/vision/dinov2_vit.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.715853 | """
dinov2_vit.py
"""
from prismatic.models.backbones.vision.base_vision import TimmViTBackbone
# Registry =>> Supported DINOv2 Vision Backbones (from TIMM) =>> Note:: Using DINOv2 w/ Registers!
# => Reference: https://arxiv.org/abs/2309.16588
DINOv2_VISION_BACKBONES = {"dinov2-vit-l": "vit_large_patch14_reg4_dinov... |
TRI-ML/prismatic-vlms | https://github.com/TRI-ML/prismatic-vlms | null | null | null | null | 975 | null | null | mit | null | null | null | null | null | null | null | prismatic/models/backbones/vision/dinosiglip_vit.py | null | null | null | null | null | null | Python | 2026-05-04T01:37:16.751802 | """
dinosiglip_vit.py
Vision backbone that returns concatenated features from both DINOv2 and SigLIP.
"""
from dataclasses import dataclass
from functools import partial
from typing import Callable, Dict, Tuple
import timm
import torch
from PIL import Image
from timm.models.vision_transformer import Block, VisionTra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.