id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
2,059
import numpy as np import matplotlib.pyplot as plt from scipy.special import binom from numpy.linalg import norm def num_bezier(n_ctrl, degree=3): def plot_control_polygon(Cp, degree=3, lw=0.5, linecolor=np.ones(3)*0.1): n_bezier = num_bezier(len(Cp), degree) for i in range(n_bezier): cp = Cp[i*degree:...
null
2,060
import argparse import traceback import shutil import logging import yaml import sys import os import torch import numpy as np import torch.utils.tensorboard as tb from runners.diffusion import Diffusion torch.set_printoptions(sci_mode=False) def dict2namespace(config): namespace = argparse.Namespace() for key,...
null
2,061
import torch def noise_estimation_loss(model, x0: torch.Tensor, t: torch.LongTensor, e: torch.Tensor, b: torch.Tensor, keepdim=False): a = (1-b).cumprod(dim=0).index_select(0, t).view(-1, 1, 1, 1) x = x0 * a...
null
2,062
import os, hashlib import requests from tqdm import tqdm URL_MAP = { "cifar10": "https://heibox.uni-heidelberg.de/f/869980b53bf5416c8a28/?dl=1", "ema_cifar10": "https://heibox.uni-heidelberg.de/f/2e4f01e2d9ee49bab1d5/?dl=1", "lsun_bedroom": "https://heibox.uni-heidelberg.de/f/f179d4f21ebc4d43bbfe/?dl=1", ...
null
2,063
import torch def compute_alpha(beta, t): beta = torch.cat([torch.zeros(1).to(beta.device), beta], dim=0) a = (1 - beta).cumprod(dim=0).index_select(0, t + 1).view(-1, 1, 1, 1) return a def generalized_steps(x, seq, model, b, **kwargs): with torch.no_grad(): n = x.size(0) seq_next = [-1]...
null
2,064
import torch def compute_alpha(beta, t): beta = torch.cat([torch.zeros(1).to(beta.device), beta], dim=0) a = (1 - beta).cumprod(dim=0).index_select(0, t + 1).view(-1, 1, 1, 1) return a def ddpm_steps(x, seq, model, b, **kwargs): with torch.no_grad(): n = x.size(0) seq_next = [-1] + list...
null
2,065
import os import logging import time import glob import numpy as np import tqdm import torch import torch.utils.data as data from models.diffusion import Model from models.ema import EMAHelper from functions import get_optimizer from functions.losses import loss_registry from datasets import get_dataset, data_transform...
null
2,066
import os import logging import time import glob import numpy as np import tqdm import torch import torch.utils.data as data from models.diffusion import Model from models.ema import EMAHelper from functions import get_optimizer from functions.losses import loss_registry from datasets import get_dataset, data_transform...
null
2,067
import os import os.path import hashlib import errno from torch.utils.model_zoo import tqdm def gen_bar_updater(): pbar = tqdm(total=None) def bar_update(count, block_size, total_size): if pbar.total is None and total_size: pbar.total = total_size progress_bytes = count * block_size ...
Download a file from a url and place it in root. Args: url (str): URL to download file from root (str): Directory to place downloaded file in filename (str, optional): Name to save the file under. If None, use the basename of the URL md5 (str, optional): MD5 checksum of the download. If None, do not check
2,068
import os import os.path import hashlib import errno from torch.utils.model_zoo import tqdm The provided code snippet includes necessary dependencies for implementing the `list_dir` function. Write a Python function `def list_dir(root, prefix=False)` to solve the following problem: List all directories at a given root...
List all directories at a given root Args: root (str): Path to directory whose folders need to be listed prefix (bool, optional): If true, prepends the path to each result, otherwise only returns the name of the directories found
2,069
import os import os.path import hashlib import errno from torch.utils.model_zoo import tqdm The provided code snippet includes necessary dependencies for implementing the `list_files` function. Write a Python function `def list_files(root, suffix, prefix=False)` to solve the following problem: List all files ending wi...
List all files ending with a suffix at a given root Args: root (str): Path to directory whose folders need to be listed suffix (str or tuple): Suffix of the files to match, e.g. '.png' or ('.jpg', '.png'). It uses the Python "str.endswith" method and is passed directly prefix (bool, optional): If true, prepends the pat...
2,070
import os import os.path import hashlib import errno from torch.utils.model_zoo import tqdm def check_integrity(fpath, md5=None): if md5 is None: return True if not os.path.isfile(fpath): return False md5o = hashlib.md5() with open(fpath, 'rb') as f: # read in 1MB chunks ...
Download a Google Drive file from and place it in root. Args: file_id (str): id of file to be downloaded root (str): Directory to place downloaded file in filename (str, optional): Name to save the file under. If None, use the id of the file. md5 (str, optional): MD5 checksum of the download. If None, do not check
2,071
import math import torch import torch.nn as nn The provided code snippet includes necessary dependencies for implementing the `get_timestep_embedding` function. Write a Python function `def get_timestep_embedding(timesteps, embedding_dim)` to solve the following problem: This matches the implementation in Denoising Di...
This matches the implementation in Denoising Diffusion Probabilistic Models: From Fairseq. Build sinusoidal embeddings. This matches the implementation in tensor2tensor, but differs slightly from the description in Section 3.5 of "Attention Is All You Need".
2,072
import math import torch import torch.nn as nn def nonlinearity(x): # swish return x*torch.sigmoid(x)
null
2,073
import math import torch import torch.nn as nn def Normalize(in_channels): return torch.nn.GroupNorm(num_groups=32, num_channels=in_channels, eps=1e-6, affine=True)
null
2,074
from concurrent.futures import ThreadPoolExecutor, as_completed from contextlib import suppress from itertools import cycle from json import load from logging import basicConfig, getLogger, shutdown from math import log2, trunc from multiprocessing import RawValue from os import urandom as randbytes from pathlib import...
null
2,075
import os import re import shutil import sys from setuptools import find_namespace_packages, setup with open('README.rst') as readme: long_description = readme.read() with open('requirements/base.txt') as fh: requirements = [r for r in fh.read().split('\n') if not r.startswith('#')] The provided code snippet i...
Return package version as listed in `__version__` in `init.py`.
2,076
from docutils.nodes import Text from sphinx.util import logging def default_role_error( name, rawtext, text, lineno, inliner, options=None, content=None ): logger.warning( ( f"Default role used (`single backticks`): {rawtext}. Did you mean to use " "two backticks for ``code``, or...
null
2,077
from rest_framework.renderers import TemplateHTMLRenderer from rest_framework.response import Response from rest_framework.reverse import reverse from rest_framework.views import APIView from drf_spectacular.plumbing import get_relative_url, set_query_parameters from drf_spectacular.settings import spectacular_settings...
null
2,078
from drf_spectacular.contrib.rest_polymorphic import PolymorphicSerializerExtension from drf_spectacular.plumbing import ResolvedComponent from drf_spectacular.serializers import PolymorphicProxySerializerExtension from drf_spectacular.settings import spectacular_settings def rollup_properties(component, resolved_sub_...
null
2,079
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,080
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,081
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,082
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,083
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,084
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,085
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
obtain model from view via view's queryset. try safer view attribute first before going through get_queryset(), which may perform arbitrary operations.
2,086
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,087
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,088
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,089
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,090
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
Either build a bearer scheme or a fallback due to OpenAPI 3.0.3 limitations
2,091
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,092
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,093
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
a model traversal chain "foreignkey.foreignkey.value" can either end with an actual model field instance "value" or a model property function named "value". differentiate the cases. :return: models.Field or function object
2,094
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
Follow a model lookup `foreignkey__foreignkey__field` in the same way that Django QuerySet.filter() does, returning the final models.Field.
2,095
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
sort endpoints first alphanumerically by path, then by method order
2,096
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
convert django style path parameters to OpenAPI parameters.
2,097
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
convert regex path parameter to OpenAPI parameter, if pattern is explicitly chosen and not the generic non-empty default '[^/.]+'.
2,098
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,099
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,100
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,101
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,102
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
resolve non-serializable objects like lazy translation strings and OrderedDict
2,103
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,104
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,105
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
build a mocked request and use original request as reference if available
2,106
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,107
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,108
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,109
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,110
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
null
2,111
import collections import functools import hashlib import inspect import json import re import sys import types import typing import urllib.parse from abc import ABCMeta from collections import OrderedDict, defaultdict from decimal import Decimal from enum import Enum from typing import ( Any, DefaultDict, Dict, Ge...
Creates a mocked view for every webhook. The given extend_schema decorator then specifies the expectations on the receiving end of the callback. Effectively simulates a sub-schema from the opposing perspective via a virtual view definition.
2,112
import inspect import sys from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Type, TypeVar, Union from django.utils.functional import Promise from rest_framework.fields import Field, empty from rest_framework.serializers import ListSerializer, Serializer from rest_framework.settings import api_settings ...
Decorator mainly for the "view" method kind. Partially or completely overrides what would be otherwise generated by drf-spectacular. :param operation_id: replaces the auto-generated operation_id. make sure there are no naming collisions. :param parameters: list of additional or replacement parameters added to the auto-...
2,113
import inspect import sys from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Type, TypeVar, Union from django.utils.functional import Promise from rest_framework.fields import Field, empty from rest_framework.serializers import ListSerializer, Serializer from rest_framework.settings import api_settings ...
Decorator for the "field" kind. Can be used with ``SerializerMethodField`` (annotate the actual method) or with custom ``serializers.Field`` implementations. If your custom serializer field base class is already the desired type, decoration is not necessary. To override the discovered base class type, you can decorate ...
2,114
import inspect import sys from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Type, TypeVar, Union from django.utils.functional import Promise from rest_framework.fields import Field, empty from rest_framework.serializers import ListSerializer, Serializer from rest_framework.settings import api_settings ...
Convenience decorator for the "view" kind. Intended for annotating derived view methods that are are not directly present in the view (usually methods like ``list`` or ``retrieve``). Spares you from overriding methods like ``list``, only to perform a super call in the body so that you have have something to attach :fun...
2,115
import inspect import sys from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Type, TypeVar, Union from django.utils.functional import Promise from rest_framework.fields import Field, empty from rest_framework.serializers import ListSerializer, Serializer from rest_framework.settings import api_settings ...
A helper function to create an inline serializer. Primary use is with :func:`@extend_schema <.extend_schema>`, where one needs an implicit one-off serializer that is not reflected in an actual class. :param name: name of the :param fields: dict with field names as keys and serializer fields as values :param kwargs: opt...
2,116
import contextlib import functools import inspect import sys from collections import defaultdict from typing import Any, Callable, DefaultDict, List, Optional, Tuple, TypeVar GENERATOR_STATS = GeneratorStats() def reset_generator_stats() -> None: GENERATOR_STATS.reset()
null
2,117
import contextlib import functools import inspect import sys from collections import defaultdict from typing import Any, Callable, DefaultDict, List, Optional, Tuple, TypeVar GENERATOR_STATS = GeneratorStats() def _get_source_location(obj): try: sourcefile = inspect.getsourcefile(obj) except: # noqa: E...
Adds a message to be used as a prefix when emitting warnings and errors.
2,118
import contextlib import functools import inspect import sys from collections import defaultdict from typing import Any, Callable, DefaultDict, List, Optional, Tuple, TypeVar F = TypeVar('F', bound=Callable[..., Any]) The provided code snippet includes necessary dependencies for implementing the `cache` function. Writ...
simple polyfill for python < 3.9
2,119
from rest_framework.utils.model_meta import get_field_info from drf_spectacular.drainage import warn from drf_spectacular.extensions import OpenApiSerializerExtension, OpenApiSerializerFieldExtension from drf_spectacular.plumbing import ( ResolvedComponent, build_array_type, build_object_type, follow_field_source, ...
null
2,120
from rest_framework.utils.model_meta import get_field_info from drf_spectacular.drainage import warn from drf_spectacular.extensions import OpenApiSerializerExtension, OpenApiSerializerFieldExtension from drf_spectacular.plumbing import ( ResolvedComponent, build_array_type, build_object_type, follow_field_source, ...
null
2,121
from rest_framework.utils.model_meta import get_field_info from drf_spectacular.drainage import warn from drf_spectacular.extensions import OpenApiSerializerExtension, OpenApiSerializerFieldExtension from drf_spectacular.plumbing import ( ResolvedComponent, build_array_type, build_object_type, follow_field_source, ...
null
2,122
from django.conf import settings from django.utils.version import get_version_tuple from rest_framework import serializers from drf_spectacular.contrib.rest_framework_simplejwt import ( SimpleJWTScheme, TokenRefreshSerializerExtension, ) from drf_spectacular.drainage import warn from drf_spectacular.extensions impo...
null
2,123
import re from typing import Optional from django.utils.module_loading import import_string def camelize_serializer_fields(result, generator, request, public): from django.conf import settings from djangorestframework_camel_case.settings import api_settings from djangorestframework_camel_case.util import c...
null
2,124
from django.core.checks import Error, Warning, register GENERATOR_STATS = GeneratorStats() spectacular_settings = SpectacularSettings( user_settings=getattr(settings, 'SPECTACULAR_SETTINGS', {}), # type: ignore defaults=SPECTACULAR_DEFAULTS, # type: ignore import_strings=IMPORT_STRINGS, ) The provided ...
Perform dummy generation and emit warnings/errors as part of Django's check framework
2,125
import re from collections import defaultdict from inflection import camelize from rest_framework.settings import api_settings from drf_spectacular.drainage import warn from drf_spectacular.plumbing import ( ResolvedComponent, list_hash, load_enum_name_overrides, safe_ref, ) from drf_spectacular.settings import spe...
simple replacement of Enum/Choices that globally share the same name and have the same choices. Aids client generation to not generate a separate enum for every occurrence. only takes effect when replacement is guaranteed to be correct.
2,126
import re from collections import defaultdict from inflection import camelize from rest_framework.settings import api_settings from drf_spectacular.drainage import warn from drf_spectacular.plumbing import ( ResolvedComponent, list_hash, load_enum_name_overrides, safe_ref, ) from drf_spectacular.settings import spe...
preprocessing hook that filters out {format} suffixed paths, in case format_suffix_patterns is used and {format} path params are unwanted.
2,127
from contextlib import contextmanager from typing import Any, Dict from django.conf import settings from rest_framework.settings import APISettings, perform_import spectacular_settings = SpectacularSettings( user_settings=getattr(settings, 'SPECTACULAR_SETTINGS', {}), # type: ignore defaults=SPECTACULAR_DEFAUL...
temporarily patch the global spectacular settings (or do nothing)
2,128
from django.utils.module_loading import import_string The provided code snippet includes necessary dependencies for implementing the `lazy_serializer` function. Write a Python function `def lazy_serializer(path: str)` to solve the following problem: simulate initiated object but actually load class and init on first u...
simulate initiated object but actually load class and init on first usage
2,129
from django.utils.module_loading import import_string def set_override(obj: Any, prop: str, value: Any) -> Any: if not hasattr(obj, '_spectacular_annotation'): obj._spectacular_annotation = {} elif '_spectacular_annotation' not in obj.__dict__: obj._spectacular_annotation = obj._spectacular_ann...
null
2,130
import json from collections import namedtuple from importlib import import_module from typing import Any, Dict, List, Optional, Type from django.conf import settings from django.templatetags.static import static from django.utils import translation from django.utils.translation import gettext_lazy as _ from django.vie...
null
2,131
import os import requests from typing import Dict, Optional, List from huggingface_hub.utils import build_hf_headers from text_generation import Client, AsyncClient, __version__ from text_generation.types import DeployedModel from text_generation.errors import NotSupportedError, parse_error class DeployedModel(BaseMod...
Get all currently deployed models with text-generation-inference-support Returns: List[DeployedModel]: list of all currently deployed models
2,132
import os import requests from typing import Dict, Optional, List from huggingface_hub.utils import build_hf_headers from text_generation import Client, AsyncClient, __version__ from text_generation.types import DeployedModel from text_generation.errors import NotSupportedError, parse_error def parse_error(status_code...
Check if a given model is supported by text-generation-inference Returns: bool: whether the model is supported by this client
2,133
import os import sys import typer from pathlib import Path from loguru import logger from typing import Optional from enum import Enum from huggingface_hub import hf_hub_download class Quantization(str, Enum): bitsandbytes = "bitsandbytes" bitsandbytes_nf4 = "bitsandbytes-nf4" bitsandbytes_fp4 = "bitsandbyt...
null
2,134
import os import sys import typer from pathlib import Path from loguru import logger from typing import Optional from enum import Enum from huggingface_hub import hf_hub_download def download_weights( model_id: str, revision: Optional[str] = None, extension: str = ".safetensors", auto_convert: bool = Tr...
null
2,135
import asyncio import os import torch import time from grpc import aio from loguru import logger from grpc_reflection.v1alpha import reflection from pathlib import Path from typing import List, Optional from text_generation_server.cache import Cache from text_generation_server.interceptor import ExceptionInterceptor fr...
null
2,136
import torch import time from dataclasses import dataclass from opentelemetry import trace from transformers import ( AutoProcessor, AutoTokenizer, PreTrainedTokenizerBase, ProcessorMixin, ) from typing import Optional, Tuple, List, Type, Dict from text_generation_server.models import Model from text_ge...
null
2,137
import torch import torch.distributed from transformers import AutoTokenizer, PreTrainedTokenizerBase from typing import Optional import os from text_generation_server.models.custom_modeling.mamba_modeling import ( MambaConfig, ) from loguru import logger from text_generation_server.pb import generate_pb2 from text...
null
2,138
import torch import torch.distributed from torch import nn from transformers.activations import ACT2FN from transformers.modeling_utils import PreTrainedModel from transformers.models.gpt_neox import GPTNeoXConfig from typing import Optional, List, Tuple from text_generation_server.utils import paged_attention, flash_a...
null
2,139
import torch import torch.distributed from torch import nn from transformers.activations import ACT2FN from transformers.modeling_utils import PreTrainedModel from transformers.models.gpt_neox import GPTNeoXConfig from typing import Optional, List, Tuple from text_generation_server.utils import paged_attention, flash_a...
null
2,140
import torch import torch.distributed from torch import nn from transformers.activations import ACT2FN from transformers.configuration_utils import PretrainedConfig from typing import Optional, List, Tuple from text_generation_server.utils import paged_attention, flash_attn from text_generation_server.utils.layers impo...
null
2,141
import torch import torch.distributed import os from shutil import copyfile from torch import nn from transformers.activations import ACT2FN from transformers.configuration_utils import PretrainedConfig from typing import Optional, List, Tuple from tokenizers import processors from transformers.tokenization_utils_fast ...
null
2,142
import torch import torch.distributed from torch import nn from transformers.activations import ACT2FN from transformers.configuration_utils import PretrainedConfig from typing import Optional, List, Tuple from text_generation_server.utils import paged_attention, flash_attn from text_generation_server.utils.layers impo...
null
2,143
from typing import Optional, Tuple, Union import os import torch import torch.distributed import torch.utils.checkpoint from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from transformers.activations import ACT2FN from transformers.file_utils import ( add_code_sample_docstrings,...
null
2,144
from typing import Optional, Tuple, Union import os import torch import torch.distributed import torch.utils.checkpoint from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from transformers.activations import ACT2FN from transformers.file_utils import ( add_code_sample_docstrings,...
null
2,145
import torch import torch.distributed from torch import nn from transformers.modeling_utils import PreTrainedModel from transformers.configuration_utils import PretrainedConfig from typing import Optional, List, Tuple from text_generation_server.utils import paged_attention, flash_attn from text_generation_server.utils...
null
2,146
import torch import torch.distributed import numpy as np from torch import nn from transformers.activations import ACT2FN from transformers.configuration_utils import PretrainedConfig from typing import Optional, List, Tuple from loguru import logger from text_generation_server.utils import paged_attention, flash_attn ...
null
2,147
import torch import torch.distributed import numpy as np from torch import nn from transformers.activations import ACT2FN from transformers.configuration_utils import PretrainedConfig from typing import Optional, List, Tuple from loguru import logger from text_generation_server.utils import paged_attention, flash_attn ...
null
2,148
import torch import torch.distributed import numpy as np from torch import nn from transformers.activations import ACT2FN from transformers.configuration_utils import PretrainedConfig from typing import Optional, List, Tuple from loguru import logger from text_generation_server.utils import paged_attention, flash_attn ...
null
2,149
import torch import torch.distributed import numpy as np from torch import nn from transformers.activations import ACT2FN from transformers.configuration_utils import PretrainedConfig from typing import Optional, List, Tuple from loguru import logger from text_generation_server.utils import paged_attention, flash_attn ...
null
2,150
import torch import torch.distributed import numpy as np from torch import nn from transformers.activations import ACT2FN from transformers.configuration_utils import PretrainedConfig from typing import Optional, List, Tuple from loguru import logger from text_generation_server.utils import paged_attention, flash_attn ...
null
2,151
import torch import torch.distributed from torch import nn from transformers.activations import ACT2FN from typing import Optional, List, Tuple from text_generation_server.utils import paged_attention, flash_attn from text_generation_server.utils.layers import ( TensorParallelRowLinear, TensorParallelColumnLine...
null
2,152
import torch import torch.distributed from torch import nn from transformers.activations import ACT2FN from typing import Optional, List, Tuple from text_generation_server.utils import paged_attention, flash_attn from text_generation_server.utils.layers import ( TensorParallelRowLinear, TensorParallelColumnLine...
null
2,153
import torch import torch.distributed from torch import nn from transformers.activations import ACT2FN from typing import Optional, List, Tuple from text_generation_server.utils import paged_attention, flash_attn from text_generation_server.utils.layers import ( TensorParallelRowLinear, TensorParallelColumnLine...
null
2,154
import torch import torch.distributed from torch import nn from transformers.activations import ACT2FN from typing import Optional, List, Tuple from text_generation_server.utils import paged_attention, flash_attn from text_generation_server.utils.layers import ( TensorParallelRowLinear, TensorParallelColumnLine...
null
2,155
from typing import Callable, List, Optional, Union from urllib.parse import urlparse from transformers.feature_extraction_utils import BatchFeature from transformers.processing_utils import ProcessorMixin from transformers.tokenization_utils_base import ( BatchEncoding, PaddingStrategy, TextInput, Trunc...
null
2,156
from typing import Callable, List, Optional, Union from urllib.parse import urlparse from transformers.feature_extraction_utils import BatchFeature from transformers.processing_utils import ProcessorMixin from transformers.tokenization_utils_base import ( BatchEncoding, PaddingStrategy, TextInput, Trunc...
null
2,157
from typing import Callable, List, Optional, Union from urllib.parse import urlparse from transformers.feature_extraction_utils import BatchFeature from transformers.processing_utils import ProcessorMixin from transformers.tokenization_utils_base import ( BatchEncoding, PaddingStrategy, TextInput, Trunc...
Checks if the passed string contains a valid url and nothing else. e.g. if space is included it's immediately invalidated the url
2,158
import torch import torch.distributed from torch import nn from transformers.activations import ACT2FN from transformers.configuration_utils import PretrainedConfig from typing import Optional, List, Tuple from text_generation_server.utils import paged_attention, flash_attn from text_generation_server.utils.layers impo...
null