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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ogx-ai/ogx | https://github.com/ogx-ai/ogx | null | null | null | null | 8,363 | null | null | mit | null | null | null | null | null | null | null | client-sdks/openapi/templates/python/lib/cli/datasets/register.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:36.606487 | # Copyright (c) The OGX Contributors.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import base64
import json
import mimetypes
import os
from typing import Literal
import click
import yaml
from ..common.utils import h... |
ogx-ai/ogx | https://github.com/ogx-ai/ogx | null | null | null | null | 8,363 | null | null | mit | null | null | null | null | null | null | null | client-sdks/openapi/templates/python/lib/cli/datasets/unregister.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:36.673357 | # Copyright (c) The OGX Contributors.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import click
from ..common.utils import handle_client_errors
@click.command("unregister")
@click.help_option("-h", "--help")
@click.... |
ogx-ai/ogx | https://github.com/ogx-ai/ogx | null | null | null | null | 8,363 | null | null | mit | null | null | null | null | null | null | null | client-sdks/openapi/templates/python/lib/cli/eval/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:36.718828 | # Copyright (c) The OGX Contributors.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from .eval import eval
__all__ = ["eval"]
|
ogx-ai/ogx | https://github.com/ogx-ai/ogx | null | null | null | null | 8,363 | null | null | mit | null | null | null | null | null | null | null | client-sdks/openapi/templates/python/lib/cli/eval/eval.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:36.922843 | # Copyright (c) The OGX Contributors.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import click
from .run_benchmark import run_benchmark
from .run_scoring import run_scoring
@click.group()
@click.help_option("-h",... |
ogx-ai/ogx | https://github.com/ogx-ai/ogx | null | null | null | null | 8,363 | null | null | mit | null | null | null | null | null | null | null | client-sdks/openapi/templates/python/lib/cli/eval/run_benchmark.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:36.952490 | # Copyright (c) The OGX Contributors.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import json
import os
import click
from rich import print as rprint
from tqdm.rich import tqdm
from ..common.utils import create_bar... |
ogx-ai/ogx | https://github.com/ogx-ai/ogx | null | null | null | null | 8,363 | null | null | mit | null | null | null | null | null | null | null | client-sdks/openapi/templates/python/lib/cli/eval/run_scoring.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:37.221819 | # Copyright (c) The OGX Contributors.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import json
import os
import click
import pandas
from rich import print as rprint
from tqdm.rich import tqdm
@click.command("run-sc... |
ogx-ai/ogx | https://github.com/ogx-ai/ogx | null | null | null | null | 8,363 | null | null | mit | null | null | null | null | null | null | null | benchmarking/rag/lib/metrics.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:37.855299 | # Copyright (c) The OGX Contributors.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
"""Retrieval and answer quality metrics — delegates to pytrec_eval, evaluate, rouge-score."""
from __future__ import annotations
imp... |
ogx-ai/ogx | https://github.com/ogx-ai/ogx | null | null | null | null | 8,363 | null | null | mit | null | null | null | null | null | null | null | benchmarking/rag/lib/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:37.855911 | # Copyright (c) The OGX Contributors.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
"""Checkpointing, batching, logging, ID mapping utilities."""
from __future__ import annotations
import json
import logging # allow... |
ogx-ai/ogx | https://github.com/ogx-ai/ogx | null | null | null | null | 8,363 | null | null | mit | null | null | null | null | null | null | null | benchmarking/vertical-scaling/mock-server.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:39.149396 | # Copyright (c) The OGX Contributors.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import json
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
MOCK_RESPONSE = {
"id": "chatcmpl-mock123",
... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | dockerfiles/settings/celery.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:41.904537 | from .docker_compose import DockerBaseSettings
class CeleryDevSettings(DockerBaseSettings):
DONT_HIT_DB = False
# TODO: review this since it may not be needed with RustFS (S3). For now,
# this is still required, but the CORS issue may have disappeared in RustFS.
# Since we can't properly set CORS on... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | dockerfiles/settings/build.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:41.920270 | from .docker_compose import DockerBaseSettings
class BuildDevSettings(DockerBaseSettings):
@property
def DATABASES(self): # noqa
return {}
DONT_HIT_DB = True
SHOW_DEBUG_TOOLBAR = False
# The secret key is not needed from the builders.
# If you get an error about it missing, you may b... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | docs/_ext/djangodocs.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:41.946041 | def setup(app):
app.add_crossref_type(
directivename="setting",
rolename="setting",
indextemplate="pair: %s; setting",
)
return {
"version": "builtin",
"parallel_read_safe": True,
"parallel_write_safe": True,
}
|
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | dockerfiles/settings/proxito.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:41.947202 | from readthedocs.settings.proxito.base import CommunityProxitoSettingsMixin
from .docker_compose import DockerBaseSettings
class ProxitoDevSettings(CommunityProxitoSettingsMixin, DockerBaseSettings):
DONT_HIT_DB = False
# El Proxito does not have django-debug-toolbar installed
@property
def DEBUG_TO... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | dockerfiles/settings/web.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:42.009973 | from .docker_compose import DockerBaseSettings
class WebDevSettings(DockerBaseSettings):
DONT_HIT_DB = False
WebDevSettings.load_settings(__name__)
|
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | manage.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:42.011742 | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE", "readthedocs.settings.docker_compose"
)
sys.path.append(os.getcwd())
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
|
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | docs/conf.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:42.069602 | """
Shared Sphinx configuration using sphinx-multiproject.
To build each project, the ``PROJECT`` environment variable is used.
.. code:: console
$ make html # build default project
$ PROJECT=dev make html # build the dev project
for more information read https://sphinx-multiproject.readthedocs.io/.
"""
im... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/acl/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:43.517335 | from django.contrib.auth import BACKEND_SESSION_KEY
from readthedocs.acl.constants import BACKEND_REQUEST_KEY
def get_auth_backend(request):
"""
Get the current auth_backend used on this request.
By default the full qualified name of the backend class
is stored on the request session, but our intern... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/allauth/providers/githubapp/urls.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:43.528160 | """Copied from allauth.socialaccount.providers.github.urls."""
from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns
from readthedocs.allauth.providers.githubapp.provider import GitHubAppProvider
urlpatterns = default_urlpatterns(GitHubAppProvider)
|
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/allauth/providers/githubapp/provider.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:43.557710 | from allauth.socialaccount.providers.github.provider import GitHubProvider
from readthedocs.allauth.providers.githubapp.views import GitHubAppOAuth2Adapter
class GitHubAppProvider(GitHubProvider):
"""
Provider for GitHub App.
We subclass the GitHubProvider to have two separate providers for the GitHub O... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/analytics/admin.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:43.570334 | """Analytics Admin classes."""
from django.contrib import admin
from .models import PageView
@admin.register(PageView)
class PageViewAdmin(admin.ModelAdmin):
raw_id_fields = ("project", "version")
list_display = ("project", "version", "path", "view_count", "date")
search_fields = ("project__slug", "vers... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/analytics/apps.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:43.654620 | """Django app config for the analytics app."""
from django.apps import AppConfig
class AnalyticsAppConfig(AppConfig):
"""Analytics app init code."""
default_auto_field = "django.db.models.BigAutoField"
name = "readthedocs.analytics"
verbose_name = "Analytics"
|
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/allauth/providers/githubapp/views.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:43.685681 | """Copied from allauth.socialaccount.providers.github.views."""
from allauth.socialaccount.providers.github.views import GitHubOAuth2Adapter
from allauth.socialaccount.providers.oauth2.views import OAuth2CallbackView
from allauth.socialaccount.providers.oauth2.views import OAuth2LoginView
class GitHubAppOAuth2Adapte... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/analytics/models.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:44.420831 | """Analytics modeling to help understand the projects on Read the Docs."""
import datetime
from collections import namedtuple
from urllib.parse import urlparse
from django.db import models
from django.db.models import Sum
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from r... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/analytics/proxied_api.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:44.674882 | """Analytics views that are served from the same domain as the docs."""
from functools import lru_cache
from urllib.parse import urlparse
import structlog
from django.http import JsonResponse
from django.shortcuts import get_object_or_404
from rest_framework import status as status_codes
from rest_framework.response ... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/analytics/tasks.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:44.722547 | """Tasks for Read the Docs' analytics."""
from django.conf import settings
from django.utils import timezone
from readthedocs.analytics.models import PageView
from readthedocs.worker import app
@app.task(queue="web")
def delete_old_page_counts():
"""
Delete page counts older than ``RTD_ANALYTICS_DEFAULT_RET... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/analytics/tests/test_models.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:44.786576 | import pytest
from django.contrib.auth.models import User
from django.db import IntegrityError
from django.test import TestCase
from django_dynamic_fixture import get
from readthedocs.analytics.models import PageView
from readthedocs.projects.models import Project
class TestModels(TestCase):
def setUp(self):
... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/analytics/tests.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:44.832642 | from unittest import mock
import pytest
from django.test import RequestFactory, TestCase, override_settings
from django.urls import reverse
from django.utils import timezone
from django_dynamic_fixture import get
from readthedocs.builds.constants import EXTERNAL
from readthedocs.builds.models import Version
from read... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/analytics/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:44.852373 | """Utilities related to analytics."""
import hashlib
import ipaddress
import structlog
from django.conf import settings
from django.utils.crypto import get_random_string
from django.utils.encoding import force_bytes
from django.utils.encoding import force_str
from user_agents import parse
log = structlog.get_logger... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/api/mixins.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:45.601128 | import functools
import structlog
from django.http import Http404
from django.utils.functional import cached_property
from readthedocs.core.unresolver import UnresolverError
from readthedocs.core.unresolver import unresolve
from readthedocs.core.utils import get_cache_tag
from readthedocs.proxito.cache import add_cac... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/api/v2/models.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:46.240298 | from datetime import timedelta
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from rest_framework_api_key.models import AbstractAPIKey
from rest_framework_api_key.models import BaseAPIKeyManager
from readthedocs.projects.models import Project
cl... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/api/v2/permissions.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:46.352233 | """Defines access permissions for the API."""
from rest_framework import permissions
from rest_framework_api_key.permissions import BaseHasAPIKey
from rest_framework_api_key.permissions import KeyParser
from readthedocs.api.v2.models import BuildAPIKey
class IsOwner(permissions.BasePermission):
"""Custom permis... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/api/v2/admin.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:46.397915 | from django.contrib import admin
from rest_framework_api_key.admin import APIKeyModelAdmin
from readthedocs.api.v2.models import BuildAPIKey
@admin.register(BuildAPIKey)
class BuildAPIKeyAdmin(APIKeyModelAdmin):
raw_id_fields = ["project"]
search_fields = [*APIKeyModelAdmin.search_fields, "project__slug"]
|
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/api/v2/adapters.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:46.482112 | from requests.adapters import HTTPAdapter
from requests_toolbelt.adapters.host_header_ssl import HostHeaderSSLAdapter
class TimeoutAdapter:
"""
Adapter to inject ``timeout`` to all the requests.
Allows us to not wait forever when querying our API internally from the
builders and make the build fail f... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/api/v2/proxied_urls.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:46.801329 | """
Proxied API URLs.
Served from the same domain docs are served,
so they can make use of features that require to have access to their cookies.
"""
from django.urls import path
from readthedocs.analytics.proxied_api import AnalyticsView
from readthedocs.api.v2.views.proxied import ProxiedEmbedAPI
from readthedocs.... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/api/v2/serializers.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:46.864747 | """Defines serializers for each of our models."""
from allauth.socialaccount.models import SocialAccount
from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import gettext as _
from generic_relations.relations import GenericRelatedField
from rest_framework import serializers
from readt... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/api/v2/tasks.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:46.956119 | from datetime import timedelta
import structlog
from django.utils import timezone
from readthedocs.api.v2.models import BuildAPIKey
from readthedocs.worker import app
log = structlog.get_logger(__name__)
@app.task(queue="web")
def delete_old_revoked_build_api_keys(days=15):
"""
Delete revoked and expired ... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/api/v2/test/test_tasks.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:46.976320 | from datetime import timedelta
from django.test import TestCase
from django.utils import timezone
from django_dynamic_fixture import get
from readthedocs.api.v2.models import BuildAPIKey
from readthedocs.api.v2.tasks import delete_old_revoked_build_api_keys
from readthedocs.projects.models import Project
class Test... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/api/v2/urls.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:47.067676 | """Define routes between URL paths and views/endpoints."""
from django.urls import include
from django.urls import path
from django.urls import re_path
from rest_framework import routers
from readthedocs.api.v2.views import core_views
from readthedocs.api.v2.views import integrations
from readthedocs.api.v2.views imp... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/api/v2/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:47.452876 | """Utility functions that are used by both views and celery tasks."""
import itertools
import re
import structlog
from django.conf import settings
from rest_framework.pagination import PageNumberPagination
from readthedocs.builds.constants import BRANCH
from readthedocs.builds.constants import INTERNAL
from readthed... |
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/api/v2/apps.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:50.439937 | from django.apps import AppConfig
class APIV2Config(AppConfig):
name = "readthedocs.api.v2"
verbose_name = "API V2"
|
readthedocs/readthedocs.org | https://github.com/readthedocs/readthedocs.org | null | null | null | null | 8,350 | null | null | mit | null | null | null | null | null | null | null | readthedocs/api/v2/client.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:50.494257 | """Simple client to access our API with Slumber credentials."""
import requests
import structlog
from django.conf import settings
from rest_framework.renderers import JSONRenderer
from slumber import API
from slumber import serialize
from urllib3.util.retry import Retry
from .adapters import TimeoutHostHeaderSSLAdapt... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/models/HG_model.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:52.785408 | import numpy as np
import torch
import os
from torch.autograd import Variable
from .base_model import BaseModel
import sys
# import pytorch_DIW_scratch
import MegaDepth.pytorch_DIW_scratch as pytorch_DIW_scratch
class HGModel(BaseModel):
def name(self):
return 'HGModel'
def __init__(self, opt,pretrain... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/SDR_compute.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:52.786919 | import time
import torch
import sys
from options.train_options import TrainOptions
opt = TrainOptions().parse() # set CUDA_VISIBLE_DEVICES before import torch
from data.data_loader import CreateDataLoader_TEST
from models.models import create_model
dataset_root = "/phoenix/S6/zl548/"
test_list_dir_l = dataset_root +... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/MegaDepth_model.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:52.788932 | import torch
import sys
from torch.autograd import Variable
import numpy as np
from .options.train_options import TrainOptions
from .models.models import create_model
__all__ = ['HourGlass']
def HourGlass(pretrained=None):
"""Constructs a ResNet-18 model.
Args:
pretrained (bool): If True, returns a ... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/data/aligned_data_loader.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:52.790664 | import random
import numpy as np
import torch.utils.data
from data.base_data_loader import BaseDataLoader
from data.image_folder import ImageFolder
from data.image_folder import ImageFolder_TEST
from builtins import object
import sys
import h5py
class PairedData(object):
def __init__(self, data_loader, flip):
... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/data/data_loader.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:52.794720 |
def CreateDataLoader(_root, _list_dir, _input_height, _input_width, is_flip = True, shuffle = True):
data_loader = None
from data.aligned_data_loader import AlignedDataLoader
data_loader = AlignedDataLoader(_root, _list_dir, _input_height, _input_width, is_flip, shuffle)
return data_loader
def Create... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | AverageMeter.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:52.797366 |
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0
def update(self, val, n=1):
self.val = val
self.sum += v... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/data/base_data_loader.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:52.798844 |
class BaseDataLoader():
def __init__(self):
pass
# def initialize(self):
# # self.opt = opt
# pass
def load_data():
return None
|
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/data/image_folder.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:52.821490 | ################################################################################
# Code from
# https://github.com/pytorch/vision/blob/master/torchvision/datasets/folder.py
# Modified the original code so that it also loads images from the current
# directory as well as the subdirectories
###############################... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/options/test_options.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:53.416696 | from .base_options import BaseOptions
class TestOptions(BaseOptions):
def initialize(self):
BaseOptions.initialize(self)
self.parser.add_argument('--ntest', type=int, default=float("inf"), help='# of test examples.')
self.parser.add_argument('--results_dir', type=str, default='./results/', ... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/pytorch_DIW_scratch.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:53.439711 |
import torch
import torch.nn as nn
from torch.autograd import Variable
from functools import reduce
class LambdaBase(nn.Sequential):
def __init__(self, fn, *args):
super(LambdaBase, self).__init__(*args)
self.lambda_func = fn
def forward_prepare(self, input):
output = []
for m... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/rmse_error_main.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:53.444092 | import time
import torch
import sys
from options.train_options import TrainOptions
opt = TrainOptions().parse() # set CUDA_VISIBLE_DEVICES before import torch
from data.data_loader import CreateDataLoader
from models.models import create_model
dataset_root = "/phoenix/S6/zl548/"
test_list_dir_l = '/phoenix/S6/zl548/... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/models/base_model.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:53.446597 | import os
import torch
class BaseModel():
def name(self):
return 'BaseModel'
def initialize(self, opt):
self.opt = opt
self.gpu_ids = opt.gpu_ids
self.isTrain = opt.isTrain
self.Tensor = torch.cuda.FloatTensor if self.gpu_ids else torch.Tensor
self.save_dir = os... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/models/models.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:53.448002 |
def create_model(opt,pretrained=None):
model = None
from .HG_model import HGModel
model = HGModel(opt,pretrained)
# print("model [%s] was created" % (model.name()))
return model
|
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/options/base_options.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:53.454546 | import argparse
import os
from ..util import util
class BaseOptions():
def __init__(self):
self.parser = argparse.ArgumentParser()
self.initialized = False
def initialize(self):
# self.parser.add_argument('--dataroot', required=True, help='path to images (should have subfolders trainA,... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/options/train_options.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:53.458344 | from .base_options import BaseOptions
class TrainOptions(BaseOptions):
def initialize(self):
BaseOptions.initialize(self)
self.parser.add_argument('--display_freq', type=int, default=100, help='frequency of showing training results on screen')
self.parser.add_argument('--print_freq', type=i... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/util/image_pool.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:54.023000 | import random
import numpy as np
import torch
from pdb import set_trace as st
from torch.autograd import Variable
class ImagePool():
def __init__(self, pool_size):
self.pool_size = pool_size
if self.pool_size > 0:
self.num_imgs = 0
self.images = []
def query(self, images... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/util/png.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:54.046226 | import struct
import zlib
def encode(buf, width, height):
""" buf: must be bytes or a bytearray in py3, a regular string in py2. formatted RGBRGB... """
assert (width * height * 3 == len(buf))
bpp = 3
def raw_data():
# reverse the vertical line order and add null bytes at the start
row_bytes = width *... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/util/html.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:54.064056 | import dominate
from dominate.tags import *
import os
class HTML:
def __init__(self, web_dir, title, reflesh=0):
self.title = title
self.web_dir = web_dir
self.img_dir = os.path.join(self.web_dir, 'images')
if not os.path.exists(self.web_dir):
os.makedirs(self.web_dir)
... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/util/util.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:54.106300 | from __future__ import print_function
import torch
import numpy as np
from PIL import Image
import inspect, re
import numpy as np
import os
import collections
# Converts a Tensor into a Numpy array
# |imtype|: the desired type of the converted numpy array
def tensor2im(image_tensor, imtype=np.uint8):
image_numpy =... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | PWCNet/correlation_package_pytorch1_0/correlation.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:54.110587 | import torch
from torch.nn.modules.module import Module
from torch.autograd import Function
import correlation_cuda
class CorrelationFunction(Function):
def __init__(self, pad_size=3, kernel_size=3, max_displacement=20, stride1=1, stride2=2, corr_multiply=1):
super(CorrelationFunction, self).__init__()
... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | MegaDepth/util/visualizer.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:54.130837 | import numpy as np
import os
import ntpath
import time
from . import util
from . import html
class Visualizer():
def __init__(self, opt):
# self.opt = opt
self.display_id = opt.display_id
self.use_html = opt.isTrain and not opt.no_html
self.win_size = opt.display_winsize
sel... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | PWCNet/correlation_package_pytorch1_0/setup.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:54.133694 | #!/usr/bin/env python3
import os
import torch
from setuptools import setup, find_packages
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
from compiler_args import nvcc_args, cxx_args
setup(
name='correlation_cuda',
ext_modules=[
CUDAExtension('correlation_cuda', [
'co... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | PWCNet/PWCNet.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:54.134799 | """
implementation of the PWC-DC network for optical flow estimation by Sun et al., 2018
Jinwei Gu and Zhile Ren
"""
import torch
import torch.nn as nn
from torch.autograd import Variable
import os
os.environ['PYTHON_EGG_CACHE'] = 'tmp/' # a writable directory
#from .correlation_package.modules.corr import Correlat... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | PWCNet/models/PWCNet.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:55.154700 | """
implementation of the PWC-DC network for optical flow estimation by Sun et al., 2018
Jinwei Gu and Zhile Ren
"""
import torch
import torch.nn as nn
from torch.autograd import Variable
import os
os.environ['PYTHON_EGG_CACHE'] = 'tmp/' # a writable directory
from correlation_package.modules.corr import Correlatio... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | colab_interpolate.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:55.358418 | import time
import os
from torch.autograd import Variable
import torch
import numpy as np
import numpy
import networks
from my_args import args
from imageio import imread, imsave
from AverageMeter import *
import shutil
import datetime
torch.backends.cudnn.benchmark = True
model = networks.__dict__[args.netName](
... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | datasets/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:55.770735 | from .Vimeo_90K_interp import Vimeo_90K_interp
__all__ = (
'Vimeo_90K_interp',
)
# Vimeo_90K = "/tmp4/wenbobao_data/vimeo_triplet"
|
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | datasets/Vimeo_90K_interp.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:55.773279 | import os.path
import random
# import glob
import math
from .listdatasets import ListDataset,Vimeo_90K_loader
def make_dataset(root, list_file):
raw_im_list = open(os.path.join(root, list_file)).read().splitlines()
# the last line is invalid in test set.
# print("The last sample is : " + raw_im_list[-1])
... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | Resblock/BasicBlock.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:55.906963 | import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import torch.nn.init as weight_init
import torch
__all__ = ['MultipleBasicBlock','MultipleBasicBlock_4']
def conv3x3(in_planes, out_planes, dilation = 1, stride=1):
"3x3 convolution with padding"
return nn.Conv2d(in_planes, out_planes, ... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | S2D_models/S2DF.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:55.908648 | import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import torch
# __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
# 'resnet152','resnet18_conv1']
__all__ = ['S2DF','S2DF_3dense','S2DF_3dense_nodilation',
'S2DF_3last','S2DF_2dense', 'BasicBlock']
mod... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | Stack.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:55.911642 |
class Stack:
def __init__(self):
self.stack = []
def pop(self):
if self.is_empty():
return None
else:
return self.stack.pop()
def push(self,val):
return self.stack.append(val)
def peak(self):
if self.is_empty():
return None
... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | datasets/listdatasets.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:55.976392 | import torch.utils.data as data
import os
import os.path
from scipy.ndimage import imread
import numpy as np
import random
def Vimeo_90K_loader(root, im_path, input_frame_size = (3, 256, 448), output_frame_size = (3, 256, 448), data_aug = True):
root = os.path.join(root,'sequences',im_path)
if data_aug and ... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | loss_function.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:56.359012 | import sys
import os
import sys
import threading
import torch
from torch.autograd import Variable
from lr_scheduler import *
from torch.autograd import gradcheck
import numpy
def charbonier_loss(x,epsilon):
loss = torch.mean(torch.sqrt(x * x + epsilon * epsilon))
return loss
def negPSNR_loss(x,epsilon):
... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | demo_MiddleBury_slowmotion.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:56.364793 | import time
import os
from torch.autograd import Variable
import torch
import random
import numpy as np
import numpy
import networks
from my_args import args
from scipy.misc import imread, imsave
from AverageMeter import *
import shutil
torch.backends.cudnn.benchmark = True # to speed up the
DO_MiddleBurryOther = T... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | demo_MiddleBury.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:56.365494 | import time
import os
from torch.autograd import Variable
import math
import torch
import random
import numpy as np
import numpy
import networks
from my_args import args
from scipy.misc import imread, imsave
from AverageMeter import *
torch.backends.cudnn.benchmark = True # to speed up the
DO_MiddleBurryOther = ... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | lr_scheduler.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:56.401375 | from bisect import bisect_right
from torch.optim.optimizer import Optimizer
class _LRScheduler(object):
def __init__(self, optimizer, last_epoch=-1):
if not isinstance(optimizer, Optimizer):
raise TypeError('{} is not an Optimizer'.format(
type(optimizer).__name__))
... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | my_package/DepthFlowProjection/DepthFlowProjectionLayer.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:56.513322 | # this is for wrapping the customized layer
import torch
from torch.autograd import Function
#import _ext.my_lib as my_lib
import depthflowprojection_cuda as my_lib
class DepthFlowProjectionLayer(Function):
def __init__(self,requires_grad):
super(DepthFlowProjectionLayer,self).__init__()
# self.req... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | my_args.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:56.513766 | import os
import datetime
import argparse
import numpy
import networks
import torch
modelnames = networks.__all__
# import datasets
datasetNames = ('Vimeo_90K_interp') #datasets.__all__
parser = argparse.ArgumentParser(description='DAIN')
parser.add_argument('--debug',action = 'store_true', help='Enable debug mode'... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | my_package/DepthFlowProjection/DepthFlowProjectionModule.py | null | null | null | null | null | null | Python | 2026-05-04T02:11:56.549024 | # modules/FlowProjectionModule.py
from torch.nn.modules.module import Module
from .DepthFlowProjectionLayer import DepthFlowProjectionLayer #, FlowFillholeLayer
__all__ =['DepthFlowProjectionModule']
class DepthFlowProjectionModule(Module):
def __init__(self, requires_grad = True):
super(DepthFlowProjecti... |
baowenbo/DAIN | https://github.com/baowenbo/DAIN | null | null | null | null | 8,312 | null | null | mit | null | null | null | null | null | null | null | balancedsampler.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:00.495430 | from torch.utils.data.sampler import Sampler
import torch
class RandomBalancedSampler(Sampler):
"""Samples elements randomly, with an arbitrary size, independant from dataset length.
this is a balanced sampling that will sample the whole dataset with a random permutation.
Arguments:
data_source (D... |
detailyang/awesome-cheatsheet | https://github.com/detailyang/awesome-cheatsheet | null | null | null | null | 8,300 | null | null | mit | null | null | null | null | null | null | null | tests/url_validate.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:02.862541 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: detailyang
# @Date: 2016-02-25 11:23:59
# @Last Modified by: detailyang
# @Last Modified time: 2016-06-05 22:26:44
import re
import sys
import os
from requests import get
from requests.exceptions import ConnectionError, MissingSchema
url_re = re.compile('.... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | encoders.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.156480 | from tokenizers import Tokenizer
from transformers import GPT2Tokenizer, GPT2TokenizerFast
def fetch_encoder(params):
no_dataset = params.get('no_dataset', False)
if no_dataset:
return None
dataset = next(iter(params['dataset_configs'].values())) # Get the first value from the dict
path = data... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | data/train_tokenizer.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.160646 | import os
import random
import argparse
import shutil
from glob import glob
from pathlib import Path
from lm_dataformat import Reader
from tokenizers import (Tokenizer, decoders, models, pre_tokenizers,
processors, trainers)
from tokenizers.normalizers import NFKC
from tqdm import tqdm
# parse... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | model_fns.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.167655 | import mesh_tensorflow as mtf
import tensorflow.compat.v1 as tf
from tensorflow.python.tpu import tpu_estimator
import mesh_tensorflow.transformer as mtf_transformer
from optimizers import get_optimizer
from utils import (create_host_call, get_graph_info, remove_batch_from_layout, simd_mesh_setup, add_mode_to_params,
... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | models/activations.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.180404 | import mesh_tensorflow as mtf
import tensorflow.compat.v1 as tf
import random
BASE_FNS = {'gelu': mtf.gelu,
'relu': mtf.relu,
'sigmoid': mtf.sigmoid,
'tanh': mtf.tanh,
'selu': mtf.selu,
'elu': mtf.elu,
'abs': mtf.abs,
'sin': mtf.sin,
... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | export.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.182488 | import tensorflow.compat.v1 as tf
def export_model(estimator, export_dir, params,
checkpoint_path=None):
def serving_input_receiver_fn():
t = tf.placeholder(dtype=tf.int64,
shape=[1, params["n_ctx"]],
name='input_example_tensor')
... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | data/create_tfrecords.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.187555 | import argparse
import os
from pathlib import Path
import ftfy
import tensorflow as tf
from lm_dataformat import Reader
from tokenizers import Tokenizer
from transformers import GPT2TokenizerFast
from tqdm import tqdm
import logging
from multiprocessing import Pool, cpu_count
from itertools import repeat
import re
lo... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | main.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.201436 | """GPT-like model in Mesh-Tensorflow"""
from functools import partial
import mesh_tensorflow as mtf
import tensorflow.compat.v1 as tf
from tensorflow.python.tpu import tpu_config, tpu_estimator
from tensorflow_estimator.python.estimator import estimator as estimator_lib
from utils import save_config, expand_attention_... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | data/encoders.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.208718 | from tokenizers import Tokenizer
from transformers import GPT2Tokenizer, GPT2TokenizerFast
def fetch_encoder(params):
no_dataset = params.get('no_dataset', False)
if no_dataset:
return None
dataset = next(iter(params['dataset_configs'].values())) # Get the first value from the dict
path = data... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | configs.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.234087 | import json
from pathlib import Path
from collections import defaultdict
DATASETS = {}
for path in Path("configs/dataset_configs").glob("*.json"):
dataset_id = path.stem
DATASETS[dataset_id] = json.loads(path.read_text())
def fetch_model_params(model):
model_path = model if model.endswith(".json") else ... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | inputs.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.304628 | import numpy as np
import tensorflow.compat.v1 as tf
from functools import partial
from data.encoders import encode
import random
import re
import logging
from itertools import cycle
from utils import natural_sort
### IN USE ###
def _get_number_of_documents(filename):
# extracts number of files from a filename f... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | models/layers.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.739189 | import mesh_tensorflow as mtf
import tensorflow.compat.v1 as tf
import math
import mesh_tensorflow.transformer as mtf_transformer
from models.activations import get_activation_fn
# --------------------------------------------------------------------------------
# LAYERS:
sentinel = object()
def exists(x):
ret... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | models/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.763636 | import tensorflow as tf
import mesh_tensorflow as mtf
from functools import partial
def entmax_backward(explicit_inputs, all_inputs, forward_operations, outputs, output_grads, alpha=1.3, dim=None,
n_iter=50):
x, = explicit_inputs
y, = outputs
dY, = output_grads
gppr = mtf.where(mt... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | models/gpt2/gpt2.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.791244 | """GPT-like model in Mesh-Tensorflow"""
import tensorflow.compat.v1 as tf
import mesh_tensorflow.transformer as mtf_transformer
from models.utils import parse_inputs, entmax_cross_entropy_with_logits
from models.layers import *
# --------------------------------------------------------------------------------
# TRAN... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | run_experiment.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.796820 | import atexit
import sacred
import argparse
import time
import math
import subprocess
import shutil
import os
import json
import threading
import requests
import glob
from configs import fetch_model_params
import socket
import subprocess
import queue
import sys
import signal
parser = argparse.ArgumentParser()
parser.... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | tasks.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.808640 | import os.path
import json
import requests
import numpy as np
import ftfy
from data.encoders import fetch_encoder, encode
import tensorflow as tf
import re
from functools import partial
lambada_src_uri = 'http://eaidata.bmk.sh/data/lambada_test.jsonl'
normalization = 'NFKC'
# Note: this task is called "lambada" but ... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | optimizers.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.809346 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
import mesh_tensorflow as mtf
import tensorflow.compat.v1 as tf
def clip_by_global_norm(grads, clip_norm):
"""Clip the grads by global norm."""
global_norm = mtf.sqrt(mtf.add_n([mtf.reduce_su... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | test_models.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.818301 | import pytest
import traceback
import logging
from collections import defaultdict
from contextlib import contextmanager
import tensorflow as tf
tf.compat.v1.enable_eager_execution()
import mesh_tensorflow as mtf
from mesh_tensorflow import placement_mesh_impl
from inputs import mlm_sample_text
from models.gpt2 import... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | sample.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.820587 | import mesh_tensorflow as mtf
import tensorflow.compat.v1 as tf
import mesh_tensorflow.transformer as mtf_transformer
from models.utils import entmax, sample_categorical
from models.gpt2 import gpt2
def sample_autoregressive(partial_sequences,
other_features,
params... |
EleutherAI/gpt-neo | https://github.com/EleutherAI/gpt-neo | null | null | null | null | 8,278 | null | null | mit | null | null | null | null | null | null | null | utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:12:05.850849 | import re
from urllib.parse import urlparse
from shutil import rmtree
import logging
import os
from pathlib import Path
import sys
import tensorflow.compat.v1 as tf
import tensorflow.compat.v2 as tf2
import mesh_tensorflow as mtf
import mesh_tensorflow.auto_mtf
from data.encoders import fetch_encoder
import re
def set... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.