id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
7,031
from django.db import migrations from django.db.models import Q def migrate_all_mins_to_max(apps, schema_editor): BillableMetric = apps.get_model("metering_billing", "BillableMetric") BillableMetric.objects.filter(usage_aggregation_type="min").update( usage_aggregation_type="max" )
null
7,032
from django.db import migrations from django.db.models import Q def migrate_stateful_other_to_max(apps, schema_editor): BillableMetric = apps.get_model("metering_billing", "BillableMetric") BillableMetric.objects.filter( ~Q(usage_aggregation_type="max") & ~Q(usage_aggregation_type="latest"), me...
null
7,033
from django.db import migrations def populate_description(apps, schema_editor): Plan = apps.get_model("metering_billing", "Plan") for plan in Plan.objects.all(): for plan_version in plan.versions.all(): plan.plan_description = plan_version.description plan.save() bre...
null
7,034
from django.db import migrations def backtest_substitutions_to_org(apps, schema_editor): BacktestSubstitution = apps.get_model("metering_billing", "BacktestSubstitution") for bts in BacktestSubstitution.objects.all(): bts.organization = bts.backtest.organization bts.save()
null
7,035
from django.db import migrations def webhooktrigger_to_org(apps, schema_editor): WebhookTrigger = apps.get_model("metering_billing", "WebhookTrigger") for wt in WebhookTrigger.objects.all(): wt.organization = wt.webhook_endpoint.organization wt.save()
null
7,036
from django.db import migrations def custom_pricing_unit_conversion_to_org(apps, schema_editor): CustomPricingUnitConversion = apps.get_model( "metering_billing", "CustomPricingUnitConversion" ) for c in CustomPricingUnitConversion.objects.all(): c.organization = c.plan_version.organization...
null
7,037
from django.db import migrations def plan_component_to_org(apps, schema_editor): PlanComponent = apps.get_model("metering_billing", "PlanComponent") for pc in PlanComponent.objects.all(): pc.organization = pc.billable_metric.organization pc.save()
null
7,038
from django.db import migrations def price_tier_to_org(apps, schema_editor): PriceTier = apps.get_model("metering_billing", "PriceTier") for pt in PriceTier.objects.all(): pt.organization = pt.plan_component.billable_metric.organization pt.save()
null
7,039
from django.db import migrations def categorical_filter_to_org(apps, schema_editor): CategoricalFilter = apps.get_model("metering_billing", "CategoricalFilter") Metric = apps.get_model("metering_billing", "Metric") SubscriptionRecord = apps.get_model("metering_billing", "SubscriptionRecord") for m in M...
null
7,040
from django.db import migrations def numeric_filter_to_org(apps, schema_editor): NumericFilter = apps.get_model("metering_billing", "NumericFilter") Metric = apps.get_model("metering_billing", "Metric") for m in Metric.objects.all(): m2m = list(m.numeric_filters.all()) m.numeric_filters.cle...
null
7,041
from django.db import migrations def invoice_line_item_to_org(apps, schema_editor): InvoiceLineItem = apps.get_model("metering_billing", "InvoiceLineItem") for ili in InvoiceLineItem.objects.all(): ili.organization = ili.invoice.organization ili.save()
null
7,042
from django.db import migrations def pricing_unit_to_org(apps, schema_editor): PricingUnit = apps.get_model("metering_billing", "PricingUnit") Organization = apps.get_model("metering_billing", "Organization") for pu in PricingUnit.objects.filter(organization__isnull=True): for org in Organization.o...
null
7,043
from django.db import migrations def migrate_jsonfields_to_fk(apps, schema_editor): Invoice = apps.get_model("metering_billing", "Invoice") Organization = apps.get_model("metering_billing", "Organization") Subscription = apps.get_model("metering_billing", "Subscription") Customer = apps.get_model("mete...
null
7,044
from django.core.cache import cache from django.http import HttpResponseBadRequest from django.utils.translation import gettext_lazy as _ from drf_spectacular.extensions import OpenApiAuthenticationExtension from metering_billing.exceptions import ( NoMatchingAPIKey, OrganizationMismatch, UserNoOrganization...
null
7,045
import logging from decimal import Decimal, InvalidOperation import pytz from celery import shared_task from dateutil.relativedelta import relativedelta from django.conf import settings from django.db.models import Q from metering_billing.payment_processors import PAYMENT_PROCESSOR_MAP from metering_billing.serializers...
null
7,046
import logging from decimal import Decimal, InvalidOperation import pytz from celery import shared_task from dateutil.relativedelta import relativedelta from django.conf import settings from django.db.models import Q from metering_billing.payment_processors import PAYMENT_PROCESSOR_MAP from metering_billing.serializers...
null
7,047
import logging from decimal import Decimal, InvalidOperation import pytz from celery import shared_task from dateutil.relativedelta import relativedelta from django.conf import settings from django.db.models import Q from metering_billing.payment_processors import PAYMENT_PROCESSOR_MAP from metering_billing.serializers...
null
7,048
import logging from decimal import Decimal, InvalidOperation import pytz from celery import shared_task from dateutil.relativedelta import relativedelta from django.conf import settings from django.db.models import Q from metering_billing.payment_processors import PAYMENT_PROCESSOR_MAP from metering_billing.serializers...
null
7,049
import logging from decimal import Decimal, InvalidOperation import pytz from celery import shared_task from dateutil.relativedelta import relativedelta from django.conf import settings from django.db.models import Q from metering_billing.payment_processors import PAYMENT_PROCESSOR_MAP from metering_billing.serializers...
null
7,050
import logging from decimal import Decimal, InvalidOperation import pytz from celery import shared_task from dateutil.relativedelta import relativedelta from django.conf import settings from django.db.models import Q from metering_billing.payment_processors import PAYMENT_PROCESSOR_MAP from metering_billing.serializers...
null
7,051
import logging from decimal import Decimal, InvalidOperation import pytz from celery import shared_task from dateutil.relativedelta import relativedelta from django.conf import settings from django.db.models import Q from metering_billing.payment_processors import PAYMENT_PROCESSOR_MAP from metering_billing.serializers...
null
7,052
import logging from decimal import Decimal, InvalidOperation import pytz from celery import shared_task from dateutil.relativedelta import relativedelta from django.conf import settings from django.db.models import Q from metering_billing.payment_processors import PAYMENT_PROCESSOR_MAP from metering_billing.serializers...
null
7,053
import logging from decimal import Decimal, InvalidOperation import pytz from celery import shared_task from dateutil.relativedelta import relativedelta from django.conf import settings from django.db.models import Q from metering_billing.payment_processors import PAYMENT_PROCESSOR_MAP from metering_billing.serializers...
null
7,054
import logging from decimal import Decimal, InvalidOperation import pytz from celery import shared_task from dateutil.relativedelta import relativedelta from django.conf import settings from django.db.models import Q from metering_billing.payment_processors import PAYMENT_PROCESSOR_MAP from metering_billing.serializers...
null
7,055
import csv import datetime import io import logging import boto3 from botocore.exceptions import ClientError from django.conf import settings from django.utils.text import slugify from metering_billing.invoice_pdf import s3_bucket_exists, s3_file_exists from metering_billing.models import Organization from metering_bil...
null
7,056
import logging import os from decimal import Decimal from io import BytesIO import boto3 from botocore.exceptions import ClientError from django.conf import settings from django.forms.models import model_to_dict from django.utils.text import slugify from reportlab.lib.colors import Color, HexColor from reportlab.lib.pa...
Transforms a datetime date into the correct format
7,057
import logging from django.conf import settings from django.utils.text import slugify from metering_billing.utils import ( make_all_dates_times_strings, make_all_decimals_floats, now_utc, ) from metering_billing.utils.enums import WEBHOOK_TRIGGER_EVENTS from svix.api import MessageIn logger = logging.getLog...
null
7,058
import logging from django.conf import settings from django.utils.text import slugify from metering_billing.utils import ( make_all_dates_times_strings, make_all_decimals_floats, now_utc, ) from metering_billing.utils.enums import WEBHOOK_TRIGGER_EVENTS from svix.api import MessageIn logger = logging.getLog...
null
7,059
import logging from django.conf import settings from django.utils.text import slugify from metering_billing.utils import ( make_all_dates_times_strings, make_all_decimals_floats, now_utc, ) from metering_billing.utils.enums import WEBHOOK_TRIGGER_EVENTS from svix.api import MessageIn logger = logging.getLog...
null
7,060
import logging from django.conf import settings from django.utils.text import slugify from metering_billing.utils import ( make_all_dates_times_strings, make_all_decimals_floats, now_utc, ) from metering_billing.utils.enums import WEBHOOK_TRIGGER_EVENTS from svix.api import MessageIn logger = logging.getLog...
null
7,061
import logging from django.conf import settings from django.utils.text import slugify from metering_billing.utils import ( make_all_dates_times_strings, make_all_decimals_floats, now_utc, ) from metering_billing.utils.enums import WEBHOOK_TRIGGER_EVENTS from svix.api import MessageIn logger = logging.getLog...
null
7,062
import logging from django.conf import settings from django.utils.text import slugify from metering_billing.utils import ( make_all_dates_times_strings, make_all_decimals_floats, now_utc, ) from metering_billing.utils.enums import WEBHOOK_TRIGGER_EVENTS from svix.api import MessageIn logger = logging.getLog...
null
7,063
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,064
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,065
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,066
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,067
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,068
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,069
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,070
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,071
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,072
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,073
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,074
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,075
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,076
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,077
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,078
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
Turn a decimal into cents.
7,079
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,080
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,081
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,082
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,083
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,084
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,085
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,086
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,087
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,088
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,089
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,090
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,091
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,092
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,093
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,094
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,095
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,096
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,097
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,098
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,099
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,100
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,101
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,102
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,103
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
Return all rows from a cursor as a namedtuple
7,104
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,105
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,106
import collections import datetime import json import uuid from collections import OrderedDict, namedtuple from collections.abc import MutableMapping, MutableSequence from decimal import ROUND_DOWN, ROUND_HALF_UP, ROUND_UP, Decimal import pytz from dateutil import parser from dateutil.relativedelta import relativedelta...
null
7,107
import math def get_alpha(rate=30, cutoff=1): tau = 1 / (2 * math.pi * cutoff) te = 1 / rate return 1 / (1 + tau / te)
null
7,108
from torch import nn def conv(in_channels, out_channels, kernel_size=3, padding=1, bn=True, dilation=1, stride=1, relu=True, bias=True): modules = [nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding, dilation, bias=bias)] if bn: modules.append(nn.BatchNorm2d(out_channels)) if relu: ...
null
7,109
from torch import nn def conv_dw(in_channels, out_channels, kernel_size=3, padding=1, stride=1, dilation=1): return nn.Sequential( nn.Conv2d(in_channels, in_channels, kernel_size, stride, padding, dilation=dilation, groups=in_channels, bias=False), nn.BatchNorm2d(in_channels), nn.ReLU(inpla...
null
7,110
from torch import nn def conv_dw_no_bn(in_channels, out_channels, kernel_size=3, padding=1, stride=1, dilation=1): return nn.Sequential( nn.Conv2d(in_channels, in_channels, kernel_size, stride, padding, dilation=dilation, groups=in_channels, bias=False), nn.ELU(inplace=True), nn.Conv2d(in_...
null
7,111
import argparse import cv2 import os import torch from torch.nn import DataParallel import torch.optim as optim from torch.utils.data import DataLoader from torchvision import transforms from datasets.coco import CocoTrainDataset from datasets.transformations import ConvertKeypoints, Scale, Rotate, CropPad, Flip from m...
null
7,112
import argparse import cv2 import numpy as np import torch from models.with_mobilenet import PoseEstimationWithMobileNet from modules.keypoints import extract_keypoints, group_keypoints from modules.load_state import load_state from modules.pose import Pose, track_poses from val import normalize, pad_width def infer_fa...
null
7,113
import copy import json import math import os import pickle import cv2 import numpy as np import pycocotools from torch.utils.data.dataset import Dataset def get_mask(segmentations, mask): for segmentation in segmentations: rle = pycocotools.mask.frPyObjects(segmentation, mask.shape[0], mask.shape[1]) ...
null
7,114
import argparse import torch from models.with_mobilenet import PoseEstimationWithMobileNet from modules.load_state import load_state def convert_to_onnx(net, output_name): input = torch.randn(1, 3, 256, 456) input_names = ['data'] output_names = ['stage_0_output_1_heatmaps', 'stage_0_output_0_pafs', ...
null
7,115
import argparse import json import pickle The provided code snippet includes necessary dependencies for implementing the `prepare_annotations` function. Write a Python function `def prepare_annotations(annotations_per_image, images_info, net_input_size)` to solve the following problem: Prepare labels for training. For...
Prepare labels for training. For each annotated person calculates center to perform crop around it during the training. Also converts data to the internal format. :param annotations_per_image: all annotations for specified image id :param images_info: auxiliary information about all images :param net_input_size: networ...
7,116
from openai import OpenAI import sys import os import configparser API_KEYS_LOCATION = os.path.join(CONFIG_DIR, 'openaiapirc') def create_template_ini_file(): """ If the ini file does not exist create it and add the organization_id and secret_key """ if not os.path.isfile(API_KEYS_LOCATION): ...
Initialize the OpenAI API
7,117
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null
7,118
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null
7,119
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null
7,120
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null
7,121
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null
7,122
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null
7,123
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null
7,124
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null
7,125
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null
7,126
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null
7,127
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null
7,128
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null
7,129
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null
7,130
import re from typing import Callable, List, Optional, Union from sglang.backend.anthropic import Anthropic from sglang.backend.base_backend import BaseBackend from sglang.backend.openai import OpenAI from sglang.backend.runtime_endpoint import RuntimeEndpoint from sglang.backend.vertexai import VertexAI from sglang.gl...
null