repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
DeepTutor | deeptutor/partners/bus/queue.py | .py | """Async message queue for decoupled channel-agent communication."""
import asyncio
from deeptutor.partners.bus.events import InboundMessage, OutboundMessage
class MessageBus:
"""
Async message bus that decouples chat channels from the agent core.
Channels push messages to the inbound queue, and the ag... | 45 | 1,510 |
DeepTutor | deeptutor/partners/bus/events.py | .py | """Event types for the message bus."""
from dataclasses import dataclass, field
from datetime import datetime
from typing import Any
@dataclass
class InboundMessage:
"""Message received from a chat channel."""
channel: str # telegram, discord, slack, whatsapp
sender_id: str # User identifier
chat_... | 37 | 1,145 |
DeepTutor | deeptutor/partners/channels/mattermost.py | .py | """Mattermost channel implementation using the native v4 WebSocket + REST API.
Mattermost is a self-hostable, open-source team chat platform. This channel
talks to its *own* API (``/api/v4/websocket`` for events, ``/api/v4`` REST for
sending), so self-hosted deployments get a first-class integration instead of
routing... | 439 | 17,280 |
DeepTutor | deeptutor/partners/channels/mochat.py | .py | """Mochat channel implementation using Socket.IO with HTTP polling fallback."""
from __future__ import annotations
import asyncio
from collections import deque
from dataclasses import dataclass, field
from datetime import datetime, timezone
import json
from typing import Any
import httpx
from loguru import logger
fr... | 1,063 | 39,483 |
DeepTutor | deeptutor/partners/channels/slack.py | .py | """Slack channel implementation using Socket Mode."""
import asyncio
import re
from typing import Any
from loguru import logger
from pydantic import Field
from slack_sdk.socket_mode.request import SocketModeRequest
from slack_sdk.socket_mode.response import SocketModeResponse
from slack_sdk.socket_mode.websockets imp... | 322 | 12,113 |
DeepTutor | deeptutor/partners/channels/email.py | .py | """Email channel implementation using IMAP polling + SMTP replies."""
import asyncio
from datetime import date
from email import policy
from email.header import decode_header, make_header
from email.message import EmailMessage
from email.parser import BytesParser
from email.utils import parseaddr
import html
import im... | 455 | 15,816 |
DeepTutor | deeptutor/partners/channels/napcat.py | .py | """NapCat (OneBot v11) channel for personal QQ accounts, over WebSocket.
Ported from nanobot's ``channels/napcat.py``. Coexists with the official
botpy-based ``qq`` channel — this one drives a *personal* QQ account through
a NapCat (OneBot v11) WebSocket endpoint, hence the distinct display name.
"""
from __future__ ... | 583 | 22,552 |
DeepTutor | deeptutor/partners/channels/whatsapp.py | .py | """WhatsApp channel implementation using Node.js bridge."""
import asyncio
from collections import OrderedDict
import json
import mimetypes
from typing import Any
from loguru import logger
from pydantic import Field
from deeptutor.partners.bus.events import OutboundMessage
from deeptutor.partners.bus.queue import Me... | 190 | 6,918 |
DeepTutor | deeptutor/partners/channels/manager.py | .py | """Channel manager for coordinating chat channels."""
from __future__ import annotations
import asyncio
from contextlib import suppress
import hashlib
from typing import Any
from deeptutor.partners.bus.events import OutboundMessage
from deeptutor.partners.bus.queue import MessageBus
from deeptutor.partners.channels.... | 341 | 13,136 |
DeepTutor | deeptutor/partners/channels/__init__.py | .py | """Chat channels module with plugin architecture."""
from deeptutor.partners.channels.base import BaseChannel
from deeptutor.partners.channels.manager import ChannelManager
__all__ = ["BaseChannel", "ChannelManager"]
| 7 | 219 |
DeepTutor | deeptutor/partners/channels/msteams.py | .py | """Microsoft Teams channel using a tiny built-in HTTP webhook server.
Scope:
- DM-focused MVP
- text inbound/outbound
- conversation reference persistence
- sender allowlist support
- optional inbound Bot Framework bearer-token validation
- no attachments/cards/polls yet
"""
from __future__ import annotations
import... | 837 | 33,459 |
DeepTutor | deeptutor/partners/channels/feishu.py | .py | """Feishu/Lark channel implementation using lark-oapi SDK with WebSocket long connection."""
import asyncio
from collections import OrderedDict
from dataclasses import dataclass
import importlib.util
import json
import os
import re
import threading
import time
from typing import Any, Literal
import uuid
from loguru i... | 1,343 | 50,502 |
DeepTutor | deeptutor/partners/channels/registry.py | .py | """Auto-discovery for built-in channel modules and external plugins."""
from __future__ import annotations
import importlib
import pkgutil
from typing import TYPE_CHECKING
from loguru import logger
if TYPE_CHECKING:
from deeptutor.partners.channels.base import BaseChannel
_INTERNAL = frozenset({"base", "manage... | 86 | 3,061 |
DeepTutor | deeptutor/partners/channels/matrix.py | .py | """Matrix (Element) channel — inbound sync + outbound message/media delivery."""
import asyncio
import logging
import mimetypes
from pathlib import Path
from typing import Any, Literal, TypeAlias
from loguru import logger
from pydantic import Field
try:
from mistune import create_markdown
import nh3
from... | 844 | 32,268 |
DeepTutor | deeptutor/partners/channels/weixin.py | .py | """Personal WeChat (微信) channel using HTTP long-poll API.
Uses the ilinkai.weixin.qq.com API for personal WeChat messaging.
No WebSocket, no local WeChat client needed — just HTTP requests with a
bot token obtained via QR code login.
Protocol reverse-engineered from ``@tencent-weixin/openclaw-weixin`` v1.0.3.
"""
fr... | 1,565 | 61,894 |
DeepTutor | deeptutor/partners/channels/telegram.py | .py | """Telegram channel implementation using python-telegram-bot."""
from __future__ import annotations
import asyncio
from dataclasses import dataclass
import re
import time
from typing import Any, Literal
import unicodedata
from loguru import logger
from pydantic import Field
from telegram import BotCommand, ReplyPara... | 1,061 | 41,070 |
DeepTutor | deeptutor/partners/channels/qq.py | .py | """QQ channel implementation using botpy SDK."""
import asyncio
from collections import deque
from typing import TYPE_CHECKING, Any, Literal
from loguru import logger
from pydantic import Field
from deeptutor.partners.bus.events import OutboundMessage
from deeptutor.partners.bus.queue import MessageBus
from deeptuto... | 187 | 6,184 |
DeepTutor | deeptutor/partners/channels/discord.py | .py | """Discord channel implementation using Discord Gateway websocket."""
import asyncio
from dataclasses import dataclass
import json
from pathlib import Path
import time
from typing import Any, Literal
import httpx
from loguru import logger
from pydantic import Field
import websockets
from deeptutor.partners.bus.event... | 506 | 19,985 |
DeepTutor | deeptutor/partners/channels/dingtalk.py | .py | """DingTalk/DingDing channel implementation using Stream Mode."""
import asyncio
import json
import mimetypes
import os
from pathlib import Path
import time
from typing import Any
from urllib.parse import unquote, urlparse
import httpx
from loguru import logger
from pydantic import Field
from deeptutor.partners.bus.... | 528 | 19,450 |
DeepTutor | deeptutor/partners/channels/wecom.py | .py | """WeCom (Enterprise WeChat) channel implementation using wecom_aibot_sdk."""
import asyncio
from collections import OrderedDict
import importlib.util
import os
from typing import Any
from loguru import logger
from pydantic import Field
from deeptutor.partners.bus.events import OutboundMessage
from deeptutor.partner... | 382 | 13,665 |
DeepTutor | deeptutor/partners/channels/zulip.py | .py | """Zulip channel implementation using event queue API."""
from __future__ import annotations
import asyncio
from collections import deque
import hashlib
from pathlib import Path
import re
import threading
import time
from typing import Any, Literal
from urllib.parse import unquote
from loguru import logger
from pyda... | 845 | 30,185 |
DeepTutor | deeptutor/partners/channels/base.py | .py | """Base channel interface for chat platforms."""
from __future__ import annotations
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Any
from deeptutor.partners.bus.events import InboundMessage, OutboundMessage
from deeptutor.partners.bus.queue import MessageBus
def _logger():
fr... | 185 | 6,124 |
DragGAN | visualizer_drag_gradio.py | .py | import os
import os.path as osp
from argparse import ArgumentParser
from functools import partial
import gradio as gr
import numpy as np
import torch
from PIL import Image
import dnnlib
from gradio_utils import (ImageMask, draw_mask_on_image, draw_points_on_image,
get_latest_points_pair, get... | 872 | 32,392 |
DragGAN | legacy.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 324 | 16,561 |
DragGAN | gen_images.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 151 | 6,091 |
DragGAN | visualizer_drag.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 406 | 17,150 |
DragGAN | torch_utils/persistence.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 252 | 9,752 |
DragGAN | torch_utils/custom_ops.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 158 | 6,646 |
DragGAN | torch_utils/training_stats.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 269 | 10,720 |
DragGAN | torch_utils/misc.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 267 | 11,106 |
DragGAN | torch_utils/ops/bias_act.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 210 | 9,845 |
DragGAN | torch_utils/ops/filtered_lrelu.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 275 | 12,916 |
DragGAN | torch_utils/ops/conv2d_gradfix.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 199 | 9,465 |
DragGAN | torch_utils/ops/conv2d_resample.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 144 | 6,765 |
DragGAN | torch_utils/ops/upfirdn2d.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 390 | 16,424 |
DragGAN | torch_utils/ops/grid_sample_gradfix.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 78 | 3,020 |
DragGAN | torch_utils/ops/fma.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 61 | 2,047 |
DragGAN | gradio_utils/utils.py | .py | import gradio as gr
import numpy as np
from PIL import Image, ImageDraw
class ImageMask(gr.components.Image):
"""
Sets: source="canvas", tool="sketch"
"""
is_template = True
def __init__(self, **kwargs):
super().__init__(source="upload",
tool="sketch",
... | 155 | 4,856 |
DragGAN | gradio_utils/__init__.py | .py | from .utils import (ImageMask, draw_mask_on_image, draw_points_on_image,
get_latest_points_pair, get_valid_mask,
on_change_single_global_state)
__all__ = [
'draw_mask_on_image', 'draw_points_on_image',
'on_change_single_global_state', 'get_latest_points_pair',
'get_v... | 10 | 346 |
DragGAN | gui_utils/gl_utils.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 417 | 17,409 |
DragGAN | gui_utils/text_utils.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 124 | 5,637 |
DragGAN | gui_utils/glfw_window.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 230 | 7,848 |
DragGAN | gui_utils/imgui_utils.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 192 | 7,633 |
DragGAN | gui_utils/imgui_window.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 104 | 3,994 |
DragGAN | viz/renderer.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 389 | 15,576 |
DragGAN | viz/drag_widget.py | .py | import os
import torch
import numpy as np
import imgui
import dnnlib
from gui_utils import imgui_utils
#----------------------------------------------------------------------------
class DragWidget:
def __init__(self, viz):
self.viz = viz
self.point = [-1, -1]
self.poin... | 169 | 6,098 |
DragGAN | viz/latent_widget.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 97 | 3,964 |
DragGAN | viz/capture_widget.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 93 | 3,824 |
DragGAN | viz/pickle_widget.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 174 | 6,898 |
DragGAN | scripts/download_model.py | .py | import os
import sys
import json
import requests
from tqdm import tqdm
def download_file(url: str, filename: str, download_dir: str):
"""Download a file if it does not already exist."""
try:
filepath = os.path.join(download_dir, filename)
content_length = int(requests.head(url).headers.get("co... | 79 | 2,527 |
DragGAN | dnnlib/util.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 492 | 17,132 |
DragGAN | stylegan_human/alignment.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
import os
import argparse
import numpy as np
import torch
from torch.utils.data import DataLoader
from torchvision.transforms import transforms
from utils.ImagesDataset import ImagesDataset
import cv2
import time
import copy
import imutils
# for openpose bod... | 223 | 9,314 |
DragGAN | stylegan_human/insetgan.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
import torch
import torch.nn.functional as F
from tqdm import tqdm
from lpips import LPIPS
import numpy as np
from torch_utils.models import Generator as bodyGAN
from torch_utils.models_face import Generator as FaceGAN
import dlib
from utils.face_alignment impo... | 398 | 20,022 |
DragGAN | stylegan_human/run_pti.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
from random import choice
from string import ascii_uppercase
from torch.utils.data import DataLoader
from torchvision.transforms import transforms
import os
from pti.pti_configs import global_config, paths_config
import wandb
from pti.training.coaches.multi_id_... | 53 | 1,873 |
DragGAN | stylegan_human/generate.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, visit
# https://nvlabs.github.io/stylegan2/license.html
## this script is for generating ima... | 120 | 4,709 |
DragGAN | stylegan_human/legacy.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproducti... | 201 | 8,175 |
DragGAN | stylegan_human/edit.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
import os
import sys
import torch
import numpy as np
sys.path.append(".")
from torch_utils.models import Generator
import click
import cv2
from typing import List, Optional
import subprocess
import legacy
from edit.edit_helper import conv_warper, decoder, encode... | 194 | 9,579 |
DragGAN | stylegan_human/style_mixing.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproductio... | 109 | 4,579 |
DragGAN | stylegan_human/interpolation.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
## interpolate between two z code
## score all middle latent code
# https://www.aiuai.cn/aifarm1929.html
import os
import re
from typing import List
from tqdm import tqdm
import click
import dnnlib
import numpy as np
import PIL.Image
import torch
import click
i... | 148 | 5,616 |
DragGAN | stylegan_human/stylemixing_video.py | .py |
# Copyright (c) SenseTime Research. All rights reserved.
"""Here we demo style-mixing results using StyleGAN2 pretrained model.
Script reference: https://github.com/PDillis/stylegan2-fun """
import argparse
import legacy
import scipy
import numpy as np
import PIL.Image
import dnnlib
import dnnlib.tflib as tfli... | 155 | 7,444 |
DragGAN | stylegan_human/bg_white.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
import os
import click
import cv2
import numpy as np
def bg_white(seg, raw, blur_level=3, gaussian=81):
seg = cv2.blur(seg, (blur_level, blur_level))
empty = np.ones_like(seg)
seg_bg = (empty - seg) * 255
seg_bg = cv2.GaussianBlur(seg_bg,(gaus... | 57 | 1,771 |
DragGAN | stylegan_human/torch_utils/persistence.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduc... | 254 | 9,768 |
DragGAN | stylegan_human/torch_utils/custom_ops.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduct... | 238 | 10,603 |
DragGAN | stylegan_human/torch_utils/training_stats.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduct... | 271 | 10,765 |
DragGAN | stylegan_human/torch_utils/misc.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduc... | 265 | 11,052 |
DragGAN | stylegan_human/torch_utils/models.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# https://github.com/rosinality/stylegan2-pytorch/blob/master/model.py
import math
import random
import functools
import operator
import torch
from torch import nn
from torch.nn import functional as F
import torch.nn.init as init
from torch.autograd import Fun... | 756 | 22,534 |
DragGAN | stylegan_human/torch_utils/models_face.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
import math
import random
import functools
import operator
import torch
from torch import nn
from torch.nn import functional as F
import torch.nn.init as init
from torch.autograd import Function
from .op_edit import FusedLeakyReLU, fused_leaky_relu, upfirdn2d
... | 809 | 22,703 |
DragGAN | stylegan_human/torch_utils/op_edit/fused_act.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
import os
import torch
from torch import nn
from torch.nn import functional as F
from torch.autograd import Function
from torch.utils.cpp_extension import load
module_path = os.path.dirname(__file__)
fused = load(
"fused",
sources=[
os.path.jo... | 100 | 2,752 |
DragGAN | stylegan_human/torch_utils/op_edit/upfirdn2d.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
import os
import torch
from torch.nn import functional as F
from torch.autograd import Function
from torch.utils.cpp_extension import load
module_path = os.path.dirname(__file__)
upfirdn2d_op = load(
"upfirdn2d",
sources=[
os.path.join(module_... | 203 | 5,732 |
DragGAN | stylegan_human/torch_utils/ops/bias_act.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduct... | 215 | 10,105 |
DragGAN | stylegan_human/torch_utils/ops/__init__.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
#empty | 3 | 67 |
DragGAN | stylegan_human/torch_utils/ops/filtered_lrelu.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 282 | 13,520 |
DragGAN | stylegan_human/torch_utils/ops/conv2d_gradfix.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduct... | 173 | 7,735 |
DragGAN | stylegan_human/torch_utils/ops/conv2d_resample.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduct... | 159 | 7,649 |
DragGAN | stylegan_human/torch_utils/ops/upfirdn2d.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduct... | 387 | 16,345 |
DragGAN | stylegan_human/torch_utils/ops/grid_sample_gradfix.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduct... | 86 | 3,357 |
DragGAN | stylegan_human/torch_utils/ops/fma.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduct... | 63 | 2,092 |
DragGAN | stylegan_human/PP_HumanSeg/export_model/download_export_model.py | .py | # coding: utf8
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 45 | 1,849 |
DragGAN | stylegan_human/PP_HumanSeg/deploy/infer.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.ap... | 181 | 6,331 |
DragGAN | stylegan_human/PP_HumanSeg/pretrained_model/download_pretrained_model.py | .py | # coding: utf8
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 45 | 1,743 |
DragGAN | stylegan_human/pti/pti_models/e4e/psp.py | .py | import matplotlib
from pti.pti_configs import paths_config
matplotlib.use('Agg')
import torch
from torch import nn
from pti.pti_models.e4e.encoders import psp_encoders
from pti.pti_models.e4e.stylegan2.model import Generator
def get_keys(d, name):
if 'state_dict' in d:
d = d['state_dict']
d_filt = {k[... | 100 | 4,142 |
DragGAN | stylegan_human/pti/pti_models/e4e/latent_codes_pool.py | .py | import random
import torch
class LatentCodesPool:
"""This class implements latent codes buffer that stores previously generated w latent codes.
This buffer enables us to update discriminators using a history of generated w's
rather than the ones produced by the latest encoder.
"""
def __init__(se... | 56 | 2,349 |
DragGAN | stylegan_human/pti/pti_models/e4e/stylegan2/model.py | .py | import math
import random
import torch
from torch import nn
from torch.nn import functional as F
from .op.fused_act import FusedLeakyReLU, fused_leaky_relu
from .op.upfirdn2d import upfirdn2d
class PixelNorm(nn.Module):
def __init__(self):
super().__init__()
def forward(self, input):
return ... | 681 | 18,968 |
DragGAN | stylegan_human/pti/pti_models/e4e/stylegan2/op/fused_act.py | .py | import os
import torch
from torch import nn
from torch.nn import functional as F
from torch.autograd import Function
module_path = os.path.dirname(__file__)
class FusedLeakyReLU(nn.Module):
def __init__(self, channel, negative_slope=0.2, scale=2 ** 0.5):
super().__init__()
self.bias = nn.Para... | 35 | 840 |
DragGAN | stylegan_human/pti/pti_models/e4e/stylegan2/op/upfirdn2d.py | .py | import os
import torch
from torch.nn import functional as F
module_path = os.path.dirname(__file__)
def upfirdn2d(input, kernel, up=1, down=1, pad=(0, 0)):
out = upfirdn2d_native(
input, kernel, up, up, down, down, pad[0], pad[1], pad[0], pad[1]
)
return out
def upfirdn2d_native(
input,... | 60 | 1,649 |
DragGAN | stylegan_human/pti/pti_models/e4e/encoders/model_irse.py | .py | from torch.nn import Linear, Conv2d, BatchNorm1d, BatchNorm2d, PReLU, Dropout, Sequential, Module
from encoder4editing.models.encoders.helpers import get_blocks, Flatten, bottleneck_IR, bottleneck_IR_SE, l2_norm
"""
Modified Backbone implementation from [TreB1eN](https://github.com/TreB1eN/InsightFace_Pytorch)
"""
c... | 85 | 3,257 |
DragGAN | stylegan_human/pti/pti_models/e4e/encoders/psp_encoders.py | .py | from enum import Enum
import math
import numpy as np
import torch
from torch import nn
from torch.nn import Conv2d, BatchNorm2d, PReLU, Sequential, Module
from pti.pti_models.e4e.encoders.helpers import get_blocks, bottleneck_IR, bottleneck_IR_SE, _upsample_add
from pti.pti_models.e4e.stylegan2.model import EqualLinea... | 201 | 7,204 |
DragGAN | stylegan_human/pti/pti_models/e4e/encoders/helpers.py | .py | from collections import namedtuple
import torch
import torch.nn.functional as F
from torch.nn import Conv2d, BatchNorm2d, PReLU, ReLU, Sigmoid, MaxPool2d, AdaptiveAvgPool2d, Sequential, Module
"""
ArcFace implementation from [TreB1eN](https://github.com/TreB1eN/InsightFace_Pytorch)
"""
class Flatten(Module):
def... | 141 | 4,882 |
DragGAN | stylegan_human/pti/training/projectors/w_projector.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 145 | 5,977 |
DragGAN | stylegan_human/pti/training/projectors/w_plus_projector.py | .py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 148 | 5,939 |
DragGAN | stylegan_human/pti/training/coaches/base_coach.py | .py | import abc
import os
import pickle
from argparse import Namespace
import wandb
import os.path
from .localitly_regulizer import Space_Regulizer, l2_loss
import torch
from torchvision import transforms
from lpips import LPIPS
from pti.training.projectors import w_projector
from pti.pti_configs import global_config, paths... | 151 | 5,755 |
DragGAN | stylegan_human/pti/training/coaches/localitly_regulizer.py | .py | import torch
import numpy as np
import wandb
from pti.pti_configs import hyperparameters, global_config
l2_criterion = torch.nn.MSELoss(reduction='mean')
def l2_loss(real_images, generated_images):
loss = l2_criterion(real_images, generated_images)
return loss
class Space_Regulizer:
def __init__(self, o... | 64 | 2,946 |
DragGAN | stylegan_human/pti/training/coaches/multi_id_coach.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
import os
import torch
from tqdm import tqdm
from pti.pti_configs import paths_config, hyperparameters, global_config
from pti.training.coaches.base_coach import BaseCoach
from utils.log_utils import log_images_from_w
class MultiIDCoach(BaseCoach):
def ... | 80 | 2,902 |
DragGAN | stylegan_human/pti/training/coaches/single_id_coach.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
import os
import torch
from tqdm import tqdm
from pti.pti_configs import paths_config, hyperparameters, global_config
from pti.training.coaches.base_coach import BaseCoach
from utils.log_utils import log_images_from_w
from torchvision.utils import save_image
cl... | 90 | 3,471 |
DragGAN | stylegan_human/pti/pti_configs/paths_config.py | .py | import os
## Pretrained models paths
e4e = './pti/e4e_w+.pt'
stylegan2_ada_shhq = './pretrained_models/stylegan_human_v2_1024.pkl'
ir_se50 = '' #'./model_ir_se50.pth'
## Dirs for output files
checkpoints_dir = './outputs/pti/checkpoints/'
embedding_base_dir = './outputs/pti/embeddings'
experiments_output_dir = './o... | 25 | 726 |
DragGAN | stylegan_human/pti/pti_configs/hyperparameters.py | .py | ## Architechture
lpips_type = 'alex'
first_inv_type = 'w+'#'w+'
optim_type = 'adam'
## Locality regularization
latent_ball_num_of_samples = 1
locality_regularization_interval = 1
use_locality_regularization = False
regulizer_l2_lambda = 0.1
regulizer_lpips_lambda = 0.1
regulizer_alpha = 30
## Loss
pt_l2_lambda = 1
pt... | 29 | 554 |
DragGAN | stylegan_human/pti/pti_configs/global_config.py | .py | ## Device
cuda_visible_devices = '0'
device = 'cuda:0'
## Logs
training_step = 1
image_rec_result_log_snapshot = 100
pivotal_training_steps = 0
model_snapshot_interval = 400
## Run name to be updated during PTI
run_name = 'exp'
| 13 | 230 |
DragGAN | stylegan_human/edit/edit_helper.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
from legacy import save_obj, load_pkl
import torch
from torch.nn import functional as F
import pandas as pd
from .edit_config import attr_dict
import os
def conv_warper(layer, input, style, noise):
# the conv should change
conv = layer.conv
batch, i... | 216 | 8,147 |
DragGAN | stylegan_human/edit/edit_config.py | .py | # Copyright (c) SenseTime Research. All rights reserved.
attr_dict = dict(
interface_gan={ # strength
'upper_length': [-1], # strength: negative for shorter, positive for longer
'bottom_length': [1]
},
stylespace={ # layer, strength, threshold
'upper_length': [5, -5, 0.0028], # str... | 16 | 596 |
DragGAN | stylegan_human/openpose/src/model.py | .py | import torch
from collections import OrderedDict
import torch
import torch.nn as nn
def make_layers(block, no_relu_layers):
layers = []
for layer_name, v in block.items():
if 'pool' in layer_name:
layer = nn.MaxPool2d(kernel_size=v[0], stride=v[1],
paddi... | 220 | 8,745 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.