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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pydantic/pydantic | https://github.com/pydantic/pydantic | null | null | null | null | 27,670 | null | null | mit | null | null | null | null | null | null | null | pydantic-core/tests/serializers/test_pickling.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:37.853560 | import json
import pickle
from datetime import timedelta
import pytest
from pydantic_core import core_schema
from pydantic_core._pydantic_core import SchemaSerializer
def repr_function(value, _info):
return repr(value)
def test_basic_schema_serializer():
s = SchemaSerializer(core_schema.dict_schema())
... |
pydantic/pydantic | https://github.com/pydantic/pydantic | null | null | null | null | 27,670 | null | null | mit | null | null | null | null | null | null | null | pydantic-core/tests/serializers/test_set_frozenset.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:37.855095 | import json
import pytest
from dirty_equals import IsList
from pydantic_core import SchemaSerializer, core_schema
def test_set_any():
v = SchemaSerializer(core_schema.set_schema(core_schema.any_schema()))
assert v.to_python({'a', 'b', 'c'}) == {'a', 'b', 'c'}
assert v.to_python({'a', 'b', 'c'}, mode='js... |
pydantic/pydantic | https://github.com/pydantic/pydantic | null | null | null | null | 27,670 | null | null | mit | null | null | null | null | null | null | null | pydantic-core/tests/serializers/test_nullable.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:37.864495 | import pytest
from pydantic_core import SchemaSerializer, core_schema
def test_nullable():
s = SchemaSerializer(core_schema.nullable_schema(core_schema.int_schema()))
assert s.to_python(None) is None
assert s.to_python(1) == 1
assert s.to_python(None, mode='json') is None
assert s.to_python(1, mo... |
pydantic/pydantic | https://github.com/pydantic/pydantic | null | null | null | null | 27,670 | null | null | mit | null | null | null | null | null | null | null | pydantic-core/tests/serializers/test_simple.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:37.894366 | import json
from enum import IntEnum
import pytest
from pydantic_core import CoreConfig, SchemaSerializer, core_schema
try:
import numpy
except ImportError:
numpy = None
class IntSubClass(int):
pass
class MyIntEnum(IntEnum):
one = 1
two = 2
class FloatSubClass(float):
pass
# A number ... |
pydantic/pydantic | https://github.com/pydantic/pydantic | null | null | null | null | 27,670 | null | null | mit | null | null | null | null | null | null | null | pydantic-core/tests/serializers/test_string.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:38.594999 | import json
from enum import Enum
import pytest
from pydantic_core import PydanticSerializationError, SchemaSerializer, core_schema
def test_str():
v = SchemaSerializer(core_schema.str_schema())
assert v.to_python('foobar') == 'foobar'
assert v.to_python('emoji 💩') == 'emoji 💩'
assert v.to_json('f... |
pydantic/pydantic | https://github.com/pydantic/pydantic | null | null | null | null | 27,670 | null | null | mit | null | null | null | null | null | null | null | pydantic-core/tests/serializers/test_uuid.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:38.803126 | from uuid import UUID
import pytest
from pydantic_core import SchemaSerializer, core_schema
def test_uuid():
v = SchemaSerializer(core_schema.uuid_schema())
assert v.to_python(UUID('12345678-1234-5678-1234-567812345678')) == UUID('12345678-1234-5678-1234-567812345678')
assert (
v.to_python(UUID... |
pydantic/pydantic | https://github.com/pydantic/pydantic | null | null | null | null | 27,670 | null | null | mit | null | null | null | null | null | null | null | pydantic-core/tests/serializers/test_timedelta.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:38.804666 | from datetime import timedelta
import pytest
from pydantic_core import SchemaSerializer, core_schema
try:
import pandas
except ImportError:
pandas = None
def test_timedelta():
v = SchemaSerializer(core_schema.timedelta_schema())
assert v.to_python(timedelta(days=2, hours=3, minutes=4)) == timedelta... |
pydantic/pydantic | https://github.com/pydantic/pydantic | null | null | null | null | 27,670 | null | null | mit | null | null | null | null | null | null | null | pydantic-core/tests/test_build.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:38.805578 | import pickle
import pytest
from pydantic_core import SchemaValidator
from pydantic_core import core_schema as cs
def test_schema_as_string():
v = SchemaValidator(cs.bool_schema())
assert v.validate_python('tRuE') is True
@pytest.mark.parametrize('pickle_protocol', range(1, pickle.HIGHEST_PROTOCOL + 1))
d... |
pydantic/pydantic | https://github.com/pydantic/pydantic | null | null | null | null | 27,670 | null | null | mit | null | null | null | null | null | null | null | pydantic-core/tests/serializers/test_url.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:38.806042 | import pickle
import pytest
from pydantic_core import MultiHostUrl, SchemaSerializer, SchemaValidator, Url, core_schema
def test_url():
v = SchemaValidator(core_schema.url_schema())
s = SchemaSerializer(core_schema.url_schema())
url = v.validate_python('https://example.com')
assert isinstance(url, ... |
pydantic/pydantic | https://github.com/pydantic/pydantic | null | null | null | null | 27,670 | null | null | mit | null | null | null | null | null | null | null | pydantic-core/tests/serializers/test_typed_dict.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:38.806501 | import json
from typing import Any
import pytest
from dirty_equals import IsStrictDict
from typing_extensions import TypedDict
from pydantic_core import SchemaSerializer, core_schema
@pytest.mark.parametrize('extra_behavior_kw', [{}, {'extra_behavior': 'ignore'}, {'extra_behavior': None}])
def test_typed_dict(extra... |
pydantic/pydantic | https://github.com/pydantic/pydantic | null | null | null | null | 27,670 | null | null | mit | null | null | null | null | null | null | null | pydantic-core/tests/serializers/test_union.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:38.807223 | from __future__ import annotations
import dataclasses
import json
import uuid
import warnings
from decimal import Decimal
from typing import Any, ClassVar, Literal
import pytest
from pydantic_core import PydanticSerializationUnexpectedValue, SchemaSerializer, core_schema
class BaseModel:
def __init__(self, **k... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/api/admin.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.072635 | __package__ = "archivebox.api"
from django.contrib import admin
from django.http import HttpRequest
from signal_webhooks.admin import WebhookAdmin
from signal_webhooks.utils import get_webhook_model
from archivebox.base_models.admin import BaseModelAdmin
from archivebox.api.models import APIToken
class APITokenAdm... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/api/middleware.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.073825 | __package__ = "archivebox.api"
from django.http import HttpResponse
class ApiCorsMiddleware:
"""Attach permissive CORS headers for API routes (token-based auth)."""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
if request.path.startswith... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/__main__.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.088165 | #!/usr/bin/env python3
"""This is the entrypoint for python -m archivebox ..."""
__package__ = "archivebox"
import archivebox # noqa # make sure monkey patches are applied before anything else
import sys
from .cli import main
ASCII_LOGO_MINI = r"""
_ _ _ ____
/ \ _ __ ___| |__ ... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.099663 | #!/usr/bin/env python3
# Welcome to the ArchiveBox source code! Thanks for checking it out!
#
# "We are swimming upstream against a great torrent of disorganization.
# In this, our main obligation is to establish arbitrary enclaves of order and system.
# It is the greatest possible victory to be, to continue to be, an... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/api/apps.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.108948 | __package__ = "archivebox.api"
from django.apps import AppConfig
class APIConfig(AppConfig):
name = "archivebox.api"
label = "api"
def register_admin(admin_site):
from archivebox.api.admin import register_admin
register_admin(admin_site)
|
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/api/models.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.141819 | __package__ = "archivebox.api"
import secrets
from archivebox.uuid_compat import uuid7
from django.conf import settings
from django.db import models
from django.utils import timezone
from django_stubs_ext.db.models import TypedModelMeta
from signal_webhooks.models import WebhookBase
from archivebox.base_models.model... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/api/auth.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.160811 | __package__ = "archivebox.api"
from datetime import timedelta
from django.utils import timezone
from django.http import HttpRequest
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from ninja.security import HttpBearer, APIKeyQuery, APIKeyHeader, HttpBasicAuth
from ninja.error... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/api/urls.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.627499 | __package__ = "archivebox.api"
from django.urls import path
from django.views.generic.base import RedirectView
from .v1_api import urls as v1_api_urls
urlpatterns = [
path("", RedirectView.as_view(url="/api/v1/docs")),
path("v1/", RedirectView.as_view(url="/api/v1/docs")),
path("v1/", v1_api_urls),
p... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/api/v1_api.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.644643 | __package__ = "archivebox.api"
from io import StringIO
from traceback import format_exception
from contextlib import redirect_stdout, redirect_stderr
from django.http import HttpRequest, HttpResponse
from django.core.exceptions import ObjectDoesNotExist, EmptyResultSet, PermissionDenied
from django.contrib.auth.mode... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/api/v1_core.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.709863 | __package__ = "archivebox.api"
import math
from collections import defaultdict
from uuid import UUID
from typing import Union, Any, Annotated
from datetime import datetime
from django.db.models import Model, Q, Sum
from django.db.models.functions import Coalesce
from django.conf import settings
from django.http impor... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/api/v1_machine.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.714689 | __package__ = "archivebox.api"
from uuid import UUID
from typing import Annotated
from datetime import datetime
from django.http import HttpRequest
from ninja import FilterLookup, FilterSchema, Query, Router, Schema
from ninja.pagination import paginate
from archivebox.api.v1_core import CustomPagination
router =... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/api/v1_auth.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.719700 | __package__ = "archivebox.api"
from django.http import HttpRequest
from ninja import Router, Schema
from archivebox.api.auth import auth_using_token, auth_using_password, get_or_create_api_token
router = Router(tags=["Authentication"], auth=None)
class PasswordAuthSchema(Schema):
"""Schema for a /get_api_tok... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/api/v1_crawls.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.731505 | __package__ = "archivebox.api"
from uuid import UUID
from datetime import datetime
from django.http import HttpRequest
from django.utils import timezone
from django.contrib.auth import get_user_model
from django.contrib.auth.models import User
from ninja import Router, Schema
from ninja.errors import HttpError
from... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/base_models/admin.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.732729 | """Base admin classes for models using UUIDv7."""
__package__ = "archivebox.base_models"
import json
from collections.abc import Mapping
from typing import NotRequired, TypedDict
from django import forms
from django.contrib import admin
from django.db import models
from django.forms.renderers import BaseRenderer
fro... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/api/v1_cli.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.739802 | __package__ = "archivebox.api"
import json
from io import StringIO
from typing import Any
from enum import Enum
from django.http import HttpRequest
from ninja import Router, Schema
from archivebox.misc.util import ansi_to_html
from archivebox.config.common import ARCHIVING_CONFIG
# from .auth import API_AUTH_METH... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/base_models/apps.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:41.756872 | # from django.apps import AppConfig
# class BaseModelsConfig(AppConfig):
# default_auto_field = 'django.db.models.BigAutoField'
# name = 'base_models'
|
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/base_models/models.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.258551 | """Base models using UUIDv7 for all id fields."""
__package__ = "archivebox.base_models"
from archivebox.uuid_compat import uuid7
from pathlib import Path
from django.db import models
from django.db.models import F
from django.utils import timezone
from django.contrib.auth import get_user_model
from django.urls impo... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.322119 | __package__ = "archivebox.cli"
__command__ = "archivebox"
import os
import sys
from importlib import import_module
import rich_click as click
from rich import print
from archivebox.config.version import VERSION
if "--debug" in sys.argv:
os.environ["DEBUG"] = "True"
sys.argv.remove("--debug")
class Archive... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_archiveresult.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.328838 | #!/usr/bin/env python3
"""
archivebox archiveresult <action> [args...] [--filters]
Manage ArchiveResult records (plugin extraction results).
Actions:
create - Create ArchiveResults for Snapshots (queue extractions)
list - List ArchiveResults as JSONL (with optional filters)
update - Update ArchiveRe... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_add.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.330115 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
__command__ = "archivebox add"
import sys
from pathlib import Path
from typing import TYPE_CHECKING
import rich_click as click
from django.utils import timezone
from django.db.models import QuerySet
from archivebox.misc.util import enforce_types, docstring
fro... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_crawl.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.333735 | #!/usr/bin/env python3
"""
archivebox crawl <action> [args...] [--filters]
Manage Crawl records.
Actions:
create - Create Crawl jobs from URLs
list - List Crawls as JSONL (with optional filters)
update - Update Crawls from stdin JSONL
delete - Delete Crawls from stdin JSONL
Examples:
# Cre... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_config.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.342674 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
import sys
import rich_click as click
from rich import print
from benedict import benedict
from archivebox.misc.util import docstring, enforce_types
from archivebox.misc.toml_util import CustomTOMLEncoder
@enforce_types
def config(
*keys,
get: bool = Fa... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_crawl_compat.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.350675 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
__command__ = "archivebox crawl"
import sys
import rich_click as click
from archivebox.cli.archivebox_add import add
@click.command(context_settings={"ignore_unknown_options": True})
@click.option("--depth", "-d", type=int, default=0, help="Max crawl depth (de... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_binary.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.351563 | #!/usr/bin/env python3
"""
archivebox binary <action> [args...] [--filters]
Manage Binary records (detected executables like chrome, wget, etc.).
Actions:
create - Create/register a Binary
list - List Binaries as JSONL (with optional filters)
update - Update Binaries from stdin JSONL
delete - D... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_extract.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.383470 | #!/usr/bin/env python3
"""
archivebox extract [snapshot_ids...] [--plugins=NAMES]
Run plugins on Snapshots. Accepts snapshot IDs as arguments, from stdin, or via JSONL.
Input formats:
- Snapshot UUIDs (one per line)
- JSONL: {"type": "Snapshot", "id": "...", "url": "..."}
- JSONL: {"type": "ArchiveResult... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_help.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.797353 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
__command__ = "archivebox help"
import os
from pathlib import Path
import click
from rich import print
from rich.panel import Panel
def help() -> None:
"""Print the ArchiveBox help message and usage"""
from archivebox.cli import ArchiveBoxGroup
from... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_init.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.885731 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
import os
import sys
from pathlib import Path
from collections.abc import Mapping
from rich import print
import rich_click as click
from archivebox.misc.util import docstring, enforce_types
def _normalize_snapshot_record(link_dict: Mapping[str, object]) -> tup... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_install.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.918593 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
import os
import rich_click as click
from rich import print
from archivebox.misc.util import docstring, enforce_types
@enforce_types
def install(binaries: tuple[str, ...] = (), binproviders: str = "*", dry_run: bool = False) -> None:
"""Detect and install ... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_list.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.966797 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
__command__ = "archivebox list"
import sys
import rich_click as click
from archivebox.cli.archivebox_snapshot import list_snapshots
@click.command()
@click.option("--status", "-s", help="Filter by status (queued, started, sealed)")
@click.option("--url__iconta... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_manage.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.969021 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
import rich_click as click
from archivebox.misc.util import docstring, enforce_types
@enforce_types
def manage(args: list[str] | None = None) -> None:
"""Run an ArchiveBox Django management command"""
from archivebox.config.common import SHELL_CONFIG
... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_mcp.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.969552 | #!/usr/bin/env python3
"""
archivebox mcp
Start the Model Context Protocol (MCP) server in stdio mode.
Exposes all ArchiveBox CLI commands as MCP tools for AI agents.
"""
__package__ = "archivebox.cli"
__command__ = "archivebox mcp"
import rich_click as click
from archivebox.misc.util import docstring, enforce_type... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_persona.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.971022 | #!/usr/bin/env python3
"""
archivebox persona <action> [args...] [--filters]
Manage Persona records (browser profiles for archiving).
Actions:
create - Create Personas
list - List Personas as JSONL (with optional filters)
update - Update Personas from stdin JSONL
delete - Delete Personas from s... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_machine.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.980415 | #!/usr/bin/env python3
"""
archivebox machine <action> [--filters]
Manage Machine records (system-managed, mostly read-only).
Machine records track the host machines where ArchiveBox runs.
They are created automatically by the system and are primarily for debugging.
Actions:
list - List Machines as JSONL (wi... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_pluginmap.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:42.981076 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
import rich_click as click
from archivebox.misc.util import docstring, enforce_types
EVENT_FLOW_DIAGRAM = """
┌─────────────────────────────────────────────────────────────────────────────┐
│ ArchiveBox / abx-dl Flow ... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_process.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:43.016443 | #!/usr/bin/env python3
"""
archivebox process <action> [--filters]
Manage Process records (system-managed, mostly read-only).
Process records track executions of binaries during extraction.
They are created automatically by the system and are primarily for debugging.
Actions:
list - List Processes as JSONL (... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_remove.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:43.399373 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
__command__ = "archivebox remove"
import shutil
from pathlib import Path
from collections.abc import Iterable
import rich_click as click
from django.db.models import QuerySet
from archivebox.config import DATA_DIR
from archivebox.config.constants import CONSTAN... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_run.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:43.480199 | #!/usr/bin/env python3
"""
archivebox run [--daemon] [--crawl-id=...] [--snapshot-id=...] [--binary-id=...]
Unified command for processing queued work on the shared abx-dl bus.
Modes:
- With stdin JSONL: Process piped records, exit when complete
- Without stdin (TTY): Run the background runner in foreground ... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_schedule.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:43.488477 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
import rich_click as click
from rich import print
from archivebox.misc.util import enforce_types, docstring
from archivebox.config.common import ARCHIVING_CONFIG
@enforce_types
def schedule(
add: bool = False,
show: bool = False,
clear: bool = False... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_server.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:43.553764 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
from collections.abc import Iterable
import sys
import rich_click as click
from rich import print
from archivebox.misc.util import docstring, enforce_types
from archivebox.config.common import SERVER_CONFIG
def stop_existing_background_runner(*, machine, proce... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_search.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:43.573346 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
__command__ = "archivebox search"
import sys
from pathlib import Path
from typing import TYPE_CHECKING
from collections.abc import Callable
import rich_click as click
from django.db.models import Q, QuerySet
from archivebox.config import DATA_DIR
from archivebo... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_snapshot.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:43.578441 | #!/usr/bin/env python3
"""
archivebox snapshot <action> [args...] [--filters]
Manage Snapshot records.
Actions:
create - Create Snapshots from URLs or Crawl JSONL
list - List Snapshots as JSONL (with optional filters)
update - Update Snapshots from stdin JSONL
delete - Delete Snapshots from std... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_snapshot_compat.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:43.579245 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
__command__ = "archivebox snapshot"
import sys
import rich_click as click
from archivebox.cli.archivebox_snapshot import create_snapshots
@click.command(context_settings={"ignore_unknown_options": True})
@click.option("--tag", "-t", default="", help="Comma-sep... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_shell.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:43.589960 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
from collections.abc import Iterable
import rich_click as click
from archivebox.misc.util import docstring
def shell(args: Iterable[str] = ()) -> None:
"""Enter an interactive ArchiveBox Django shell"""
from django.core.management import call_command
... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_status.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:43.591922 | #!/usr/bin/env python3
__package__ = "archivebox.cli"
from pathlib import Path
import rich_click as click
from rich import print
from archivebox.misc.util import enforce_types, docstring
from archivebox.config import DATA_DIR, CONSTANTS, ARCHIVE_DIR
from archivebox.config.common import SHELL_CONFIG
from archivebox.... |
ArchiveBox/ArchiveBox | https://github.com/ArchiveBox/ArchiveBox | null | null | null | null | 27,349 | null | null | mit | null | null | null | null | null | null | null | archivebox/cli/archivebox_tag.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:43.638436 | #!/usr/bin/env python3
"""
archivebox tag <action> [args...] [--filters]
Manage Tag records.
Actions:
create - Create Tags
list - List Tags as JSONL (with optional filters)
update - Update Tags from stdin JSONL
delete - Delete Tags from stdin JSONL
Examples:
# Create
archivebox tag cre... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/demo/detect.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:45.819442 | import argparse
import cv2
import numpy as np
try:
from imwatermark import WatermarkDecoder
except ImportError as e:
try:
# Assume some of the other dependencies such as torch are not fulfilled
# import file without loading unnecessary libraries.
import importlib.util
import sy... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/demo/sv3d_helpers.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:45.822544 | import os
import matplotlib.pyplot as plt
import numpy as np
def generate_dynamic_cycle_xy_values(
length=21,
init_elev=0,
num_components=84,
frequency_range=(1, 5),
amplitude_range=(0.5, 10),
step_range=(0, 2),
):
# Y values generation
y_sequence = np.ones(length) * init_elev
for... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/demo/gradio_app_sv4d.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:45.825626 | # Adding this at the very top of app.py to make 'generative-models' directory discoverable
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "generative-models"))
from glob import glob
from typing import Optional
import gradio as gr
import numpy as np
import torch
from huggingface_hub impo... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/demo/sampling.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:45.827357 | from pytorch_lightning import seed_everything
from scripts.demo.streamlit_helpers import *
SAVE_PATH = "outputs/demo/txt2img/"
SD_XL_BASE_RATIOS = {
"0.5": (704, 1408),
"0.52": (704, 1344),
"0.57": (768, 1344),
"0.6": (768, 1280),
"0.68": (832, 1216),
"0.72": (832, 1152),
"0.78": (896, 11... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/demo/discretization.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:45.840914 | import torch
from sgm.modules.diffusionmodules.discretizer import Discretization
class Img2ImgDiscretizationWrapper:
"""
wraps a discretizer, and prunes the sigmas
params:
strength: float between 0.0 and 1.0. 1.0 means full sampling (all sigmas are returned)
"""
def __init__(self, discre... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/demo/gradio_app.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:45.842417 | # Adding this at the very top of app.py to make 'generative-models' directory discoverable
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "generative-models"))
import math
import random
import uuid
from glob import glob
from pathlib import Path
from typing import Optional
import cv2
imp... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/demo/streamlit_helpers.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:45.875637 | import copy
import math
import os
from glob import glob
from typing import Dict, List, Optional, Tuple, Union
import cv2
import imageio
import numpy as np
import streamlit as st
import torch
import torch.nn as nn
import torchvision.transforms as TT
from einops import rearrange, repeat
from imwatermark import Watermark... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | main.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:45.882681 | import argparse
import datetime
import glob
import inspect
import os
import sys
from inspect import Parameter
from typing import Union
import numpy as np
import pytorch_lightning as pl
import torch
import torchvision
import wandb
from matplotlib import pyplot as plt
from natsort import natsorted
from omegaconf import ... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/sampling/simple_video_sample.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:46.827974 | import math
import os
import sys
from glob import glob
from pathlib import Path
from typing import List, Optional
sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), "../../")))
import cv2
import imageio
import numpy as np
import torch
from einops import rearrange, repeat
from fire import Fire
fro... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/demo/turbo.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:46.831136 | from st_keyup import st_keyup
from streamlit_helpers import *
from sgm.modules.diffusionmodules.sampling import EulerAncestralSampler
VERSION2SPECS = {
"SDXL-Turbo": {
"H": 512,
"W": 512,
"C": 4,
"f": 8,
"is_legacy": False,
"config": "configs/inference/sd_xl_base.ya... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/util/detection/nsfw_and_watermark_dectection.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:46.832197 | import os
import clip
import numpy as np
import torch
import torchvision.transforms as T
from PIL import Image
RESOURCES_ROOT = "scripts/util/detection/"
def predict_proba(X, weights, biases):
logits = X @ weights.T + biases
proba = np.where(
logits >= 0, 1 / (1 + np.exp(-logits)), np.exp(logits) / ... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/sampling/simple_video_sample_4d.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:46.834060 | import os
import sys
from glob import glob
from typing import List, Optional, Union
from tqdm import tqdm
sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), "../../")))
import numpy as np
import torch
from fire import Fire
from sgm.modules.encoders.modules import VideoPredictionEmbedderWithEnco... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/sampling/simple_video_sample_4d2.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:46.838681 | import os
import sys
from glob import glob
from typing import List, Optional
from tqdm import tqdm
sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), "../../")))
import numpy as np
import torch
from fire import Fire
from scripts.demo.sv4d_helpers import (
load_model,
preprocess_video,
... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/tests/attention.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:46.862258 | import einops
import torch
import torch.nn.functional as F
import torch.utils.benchmark as benchmark
from torch.backends.cuda import SDPBackend
from sgm.modules.attention import BasicTransformerBlock, SpatialTransformer
def benchmark_attn():
# Lets define a helpful benchmarking function:
# https://pytorch.or... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/demo/sv4d_helpers.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:47.536982 | import math
import os
from glob import glob
from pathlib import Path
from typing import Dict, List, Optional, Tuple, Union
import cv2
import imageio
import numpy as np
import torch
import torchvision.transforms as TT
from einops import rearrange, repeat
from omegaconf import ListConfig, OmegaConf
from PIL import Image... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | scripts/demo/video_sampling.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:47.644884 | import os
import sys
sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), "../../")))
from pytorch_lightning import seed_everything
from scripts.demo.streamlit_helpers import *
from scripts.demo.sv3d_helpers import *
SAVE_PATH = "outputs/demo/vid/"
VERSION2SPECS = {
"svd": {
"T": 14,
... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/data/cifar10.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:47.740625 | import pytorch_lightning as pl
import torchvision
from torch.utils.data import DataLoader, Dataset
from torchvision import transforms
class CIFAR10DataDictWrapper(Dataset):
def __init__(self, dset):
super().__init__()
self.dset = dset
def __getitem__(self, i):
x, y = self.dset[i]
... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/lr_scheduler.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:48.155568 | import numpy as np
class LambdaWarmUpCosineScheduler:
"""
note: use with a base_lr of 1.0
"""
def __init__(
self,
warm_up_steps,
lr_min,
lr_max,
lr_start,
max_decay_steps,
verbosity_interval=0,
):
self.lr_warm_up_steps = warm_up_step... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/models/autoencoder.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:48.266108 | import logging
import math
import re
from abc import abstractmethod
from contextlib import contextmanager
from typing import Any, Dict, List, Optional, Tuple, Union
import pytorch_lightning as pl
import torch
import torch.nn as nn
from einops import rearrange
from packaging import version
from ..modules.autoencoding.... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/models/diffusion.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:48.378176 | import math
from contextlib import contextmanager
from typing import Any, Dict, List, Optional, Tuple, Union
import pytorch_lightning as pl
import torch
from omegaconf import ListConfig, OmegaConf
from safetensors.torch import load_file as load_safetensors
from torch.optim.lr_scheduler import LambdaLR
from ..modules ... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/attention.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:48.734193 | import logging
import math
from inspect import isfunction
from typing import Any, Optional
import torch
import torch.nn.functional as F
from einops import rearrange, repeat
from packaging import version
from torch import nn
from torch.utils.checkpoint import checkpoint
logpy = logging.getLogger(__name__)
if version.... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:48.766138 | from .encoders.modules import GeneralConditioner
UNCONDITIONAL_CONFIG = {
"target": "sgm.modules.GeneralConditioner",
"params": {"emb_models": []},
}
|
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/autoencoding/losses/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:48.976300 | __all__ = [
"GeneralLPIPSWithDiscriminator",
"LatentLPIPS",
]
from .discriminator_loss import GeneralLPIPSWithDiscriminator
from .lpips import LatentLPIPS
|
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/autoencoding/losses/discriminator_loss.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:49.335535 | from typing import Dict, Iterator, List, Optional, Tuple, Union
import numpy as np
import torch
import torch.nn as nn
import torchvision
from einops import rearrange
from matplotlib import colormaps
from matplotlib import pyplot as plt
from ....util import default, instantiate_from_config
from ..lpips.loss.lpips impo... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/autoencoding/losses/lpips.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:49.384243 | import torch
import torch.nn as nn
from ....util import default, instantiate_from_config
from ..lpips.loss.lpips import LPIPS
class LatentLPIPS(nn.Module):
def __init__(
self,
decoder_config,
perceptual_weight=1.0,
latent_weight=1.0,
scale_input_to_tgt_size=False,
... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/autoencoding/lpips/loss/lpips.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:49.911376 | """Stripped version of https://github.com/richzhang/PerceptualSimilarity/tree/master/models"""
from collections import namedtuple
import torch
import torch.nn as nn
from torchvision import models
from ..util import get_ckpt_path
class LPIPS(nn.Module):
# Learned perceptual metric
def __init__(self, use_dro... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/autoencoding/lpips/model/model.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:50.076639 | import functools
import torch.nn as nn
from ..util import ActNorm
def weights_init(m):
classname = m.__class__.__name__
if classname.find("Conv") != -1:
nn.init.normal_(m.weight.data, 0.0, 0.02)
elif classname.find("BatchNorm") != -1:
nn.init.normal_(m.weight.data, 1.0, 0.02)
nn.... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/autoencoding/lpips/util.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:50.188185 | import hashlib
import os
import requests
import torch
import torch.nn as nn
from tqdm import tqdm
URL_MAP = {"vgg_lpips": "https://heibox.uni-heidelberg.de/f/607503859c864bc1b30b/?dl=1"}
CKPT_MAP = {"vgg_lpips": "vgg.pth"}
MD5_MAP = {"vgg_lpips": "d507d7349b931f0638a25a48a722f98a"}
def download(url, local_path, c... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/autoencoding/lpips/vqperceptual.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:50.504090 | import torch
import torch.nn.functional as F
def hinge_d_loss(logits_real, logits_fake):
loss_real = torch.mean(F.relu(1.0 - logits_real))
loss_fake = torch.mean(F.relu(1.0 + logits_fake))
d_loss = 0.5 * (loss_real + loss_fake)
return d_loss
def vanilla_d_loss(logits_real, logits_fake):
d_loss =... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/autoencoding/regularizers/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:50.571891 | from abc import abstractmethod
from typing import Any, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from ....modules.distributions.distributions import \
DiagonalGaussianDistribution
from .base import AbstractRegularizer
class DiagonalGaussianRegularizer(AbstractRegularizer):
def... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/autoencoding/regularizers/base.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:50.653808 | from abc import abstractmethod
from typing import Any, Tuple
import torch
import torch.nn.functional as F
from torch import nn
class AbstractRegularizer(nn.Module):
def __init__(self):
super().__init__()
def forward(self, z: torch.Tensor) -> Tuple[torch.Tensor, dict]:
raise NotImplementedErr... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/autoencoding/regularizers/quantize.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:50.743865 | import logging
from abc import abstractmethod
from typing import Dict, Iterator, Literal, Optional, Tuple, Union
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
from torch import einsum
from .base import AbstractRegularizer, measure_perplexity
logpy ... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/autoencoding/temporal_ae.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:51.139195 | from typing import Callable, Iterable, Union
import torch
from einops import rearrange, repeat
from sgm.modules.diffusionmodules.model import (XFORMERS_IS_AVAILABLE,
AttnBlock, Decoder,
MemoryEfficientAttnBlock,
... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/modules/diffusionmodules/denoiser.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:51.242736 | from typing import Dict, Union
import torch
import torch.nn as nn
from ...util import append_dims, instantiate_from_config
from .denoiser_scaling import DenoiserScaling
from .discretizer import Discretization
class Denoiser(nn.Module):
def __init__(self, scaling_config: Dict):
super().__init__()
... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/data/mnist.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:52.404940 | import pytorch_lightning as pl
import torchvision
from torch.utils.data import DataLoader, Dataset
from torchvision import transforms
class MNISTDataDictWrapper(Dataset):
def __init__(self, dset):
super().__init__()
self.dset = dset
def __getitem__(self, i):
x, y = self.dset[i]
... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/data/dataset.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:52.405595 | from typing import Optional
import torchdata.datapipes.iter
import webdataset as wds
from omegaconf import DictConfig
from pytorch_lightning import LightningDataModule
try:
from sdata import create_dataset, create_dummy_dataset, create_loader
except ImportError as e:
print("#" * 100)
print("Datasets not y... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:52.450108 | from .models import AutoencodingEngine, DiffusionEngine
from .util import get_configs_path, instantiate_from_config
__version__ = "0.1.0"
|
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/inference/api.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:52.450725 | import pathlib
from dataclasses import asdict, dataclass
from enum import Enum
from typing import Optional
from omegaconf import OmegaConf
from sgm.inference.helpers import (Img2ImgDiscretizationWrapper, do_img2img,
do_sample)
from sgm.modules.diffusionmodules.sampling impo... |
Stability-AI/generative-models | https://github.com/Stability-AI/generative-models | null | null | null | null | 27,129 | null | null | mit | null | null | null | null | null | null | null | sgm/inference/helpers.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:52.511956 | import math
import os
from typing import List, Optional, Union
import numpy as np
import torch
from einops import rearrange
from imwatermark import WatermarkEncoder
from omegaconf import ListConfig
from PIL import Image
from torch import autocast
from sgm.util import append_dims
class WatermarkEmbedder:
def __i... |
davila7/claude-code-templates | https://github.com/davila7/claude-code-templates | null | null | null | null | 26,659 | null | null | mit | null | null | null | null | null | null | null | cli-tool/components/agents/obsidian-ops-team/Scripts/link_suggester.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:59.111120 | #!/usr/bin/env python3
"""
Link Suggester for Obsidian Vault
Identifies potential connections between notes based on content analysis.
"""
import os
import re
from pathlib import Path
from collections import defaultdict, Counter
import argparse
import json
class LinkSuggester:
def __init__(self, vault_path):
... |
davila7/claude-code-templates | https://github.com/davila7/claude-code-templates | null | null | null | null | 26,659 | null | null | mit | null | null | null | null | null | null | null | cli-tool/components/agents/obsidian-ops-team/Scripts/implement_entity_connections.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:59.112655 | #!/usr/bin/env python3
"""Implement entity-based connections from Link Suggestions Report."""
import re
import os
from pathlib import Path
# Priority entities to focus on
PRIORITY_ENTITIES = {
'langchain', 'langgraph', 'llm', 'rag', 'embedding', 'vector',
'mcp', 'model context protocol', 'api integration', '... |
davila7/claude-code-templates | https://github.com/davila7/claude-code-templates | null | null | null | null | 26,659 | null | null | mit | null | null | null | null | null | null | null | cli-tool/components/agents/obsidian-ops-team/Scripts/moc_generator.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:59.128328 | #!/usr/bin/env python3
"""
MOC (Map of Content) Generator for Obsidian Vault
Automatically generates MOCs for directories and topics.
"""
import os
import re
from pathlib import Path
from datetime import datetime
from collections import defaultdict
import argparse
class MOCGenerator:
def __init__(self, vault_path... |
davila7/claude-code-templates | https://github.com/davila7/claude-code-templates | null | null | null | null | 26,659 | null | null | mit | null | null | null | null | null | null | null | cli-tool/components/agents/obsidian-ops-team/Scripts/metadata_adder.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:59.130262 | #!/usr/bin/env python3
"""
Metadata Adder for Obsidian Vault
Adds standardized frontmatter to markdown files that lack it.
"""
import os
import re
from datetime import datetime
from pathlib import Path
import argparse
class MetadataAdder:
def __init__(self, vault_path):
self.vault_path = Path(vault_path)
... |
davila7/claude-code-templates | https://github.com/davila7/claude-code-templates | null | null | null | null | 26,659 | null | null | mit | null | null | null | null | null | null | null | cli-tool/components/agents/obsidian-ops-team/Scripts/find_keyword_connections.py | null | null | null | null | null | null | Python | 2026-05-04T02:25:59.145191 | #!/usr/bin/env python3
"""Find and implement keyword-based connections between files."""
import os
import re
from collections import Counter, defaultdict
from pathlib import Path
# Priority keywords to focus on
PRIORITY_KEYWORDS = {
'llm', 'langchain', 'langgraph', 'rag', 'embedding', 'vector',
'agent', 'auto... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.