id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
163,006 | from pathlib import Path
import nox
ROOT = Path(__file__).parent.parent.parent
def generate_parser(session: nox.Session, *, grammar: Path, to: Path, check: bool) -> None:
"""Generate a standalone lark parser to the given location.
Optionally check if there is a git diff.
"""
output = session.run(
... | null |
163,007 | from __future__ import annotations
import nox
def generate(
session: nox.Session,
*,
schema: str | None = 'tests/data/schema.prisma',
clean: bool = True,
) -> None:
if clean:
session.run('python', '-m', 'prisma_cleanup')
if schema:
args = (f'--schema={schema}',)
else:
... | null |
163,008 | from prisma import Prisma
async def order(client: Prisma) -> None:
# case: valid
await client.post.find_first(
order={
'desc': 'asc',
},
)
await client.post.find_first(
order={
'title': 'asc',
},
)
await client.post.find_first(
ord... | null |
163,009 | from prisma import validate, types
class Foo:
def validator() -> None:
# case: return type instance of type passed
validated = validate(types.PostCreateInput, {})
reveal_type(validated) # T: PostCreateInput
# case: non-typeddict type
# these are allowed as we cannot type the TypeVar properly due ... | null |
163,010 | from prisma.models import Profile
async def order() -> None:
# case: valid
await Profile.prisma().group_by(
['country'],
order={
'country': 'desc',
},
)
await Profile.prisma().group_by(
['country', 'city'],
order={
'country': 'desc',
... | null |
163,011 | from prisma.models import Types, User
class MyUser(User):
def hello(self):
async def create() -> None:
# case: valid
user = await User.prisma().create(
data={
'name': 'Robert',
},
)
reveal_type(user) # T: User
user = await User.prisma().create(
data={
... | null |
163,012 | from prisma import Prisma
async def select(client: Prisma) -> None:
# case: None
total = await client.post.count(select=None)
reveal_type(total) # T: int
# case: empty
count = await client.post.count(select={})
reveal_type(count) # T: PostCountAggregateOutput
# case: valid fields
co... | null |
163,013 | from prisma import Prisma
from prisma.models import User
async def order_by(client: Prisma, user: User) -> None:
# case: 1-M valid
await client.user.find_unique(
where={
'id': user.id,
},
include={
'posts': {
'order_by': {
'pub... | null |
163,014 | from prisma import Prisma
async def filtering(client: Prisma) -> None:
# case: all valid filter fields
await client.types.find_first(
where={
'bigint': 237283,
},
)
await client.types.find_first(
where={
'bigint': {
'not': 173283,
... | null |
163,015 | from prisma import Prisma
async def updating(client: Prisma) -> None:
# case: setting
await client.types.update(
where={
'id': 1,
},
data={
'bigint': 290521015266836500,
},
)
await client.types.update(
where={
'id': 1,
... | null |
163,016 | from typing import Dict
from prisma import Json, Prisma
def raw() -> None:
# case: valid
Json(None)
Json(True)
Json(False)
Json(1.3723)
Json(56)
Json('hello world')
Json(['hello world'])
Json(['foo', 'bar', 'baz'])
Json({'foo': 10})
Json({'foo': {'bar': {'baz': 1}}})
# ... | null |
163,017 | from typing import Dict
from prisma import Json, Prisma
def keys() -> None:
# case: valid
Json.keys(item=None)
Json.keys(item=True)
Json.keys(item=False)
Json.keys(item=1.3723)
Json.keys(item=56)
Json.keys(item='hello world')
Json.keys(item=['hello world'])
Json.keys(item=['foo', 'b... | null |
163,018 | from typing import Dict
from prisma import Json, Prisma
async def allowed_operations(client: Prisma) -> None:
model = await client.types.create(data={'json_obj': Json('foo')})
obj = model.json_obj
assert obj is not None
# case: dict is expected
assert obj['foo'] is True
# case: list is expect... | null |
163,019 | from typing import Dict
from prisma import Json, Prisma
async def narrowing_types(client: Prisma) -> None:
model = await client.types.create(data={'json_obj': Json('foo')})
obj = model.json_obj
assert obj is not None
reveal_type(obj) # T: Json
# case: dict
if isinstance(obj, dict):
re... | null |
163,020 | from typing import Dict
from prisma import Json, Prisma
async def client_api(client: Prisma) -> None:
# case: cannot pass Json to string field
# TODO: this should error
await client.types.create(
data={
'string': Json('wow'),
},
)
# case: narrowing type
model = awai... | null |
163,021 | from prisma import Prisma, Base64
async def filtering(client: Prisma) -> None:
# case: all valid filter fields
await client.types.find_first(
where={
'bytes': Base64.encode(b'foo'),
},
)
await client.types.find_first(
where={
'bytes': {
'e... | null |
163,022 | from prisma import Prisma
async def filtering(client: Prisma) -> None:
# case: all valid filter fields
await client.types.find_first(
where={
'integer': 237283,
},
)
await client.types.find_first(
where={
'integer': {
'not': 173283,
... | null |
163,023 | from prisma import Prisma
async def updating(client: Prisma) -> None:
# case: setting
await client.types.update(
where={
'id': 1,
},
data={
'integer': 290521015266836500,
},
)
await client.types.update(
where={
'id': 1,
... | null |
163,024 | from prisma import Prisma
async def filtering(client: Prisma) -> None:
# case: all valid filter fields
await client.types.find_first(
where={
'bool': True,
},
)
await client.types.find_first(
where={
'bool': {
'not': True,
},
... | null |
163,025 | from prisma import Prisma
async def updating(client: Prisma) -> None:
# case: setting
await client.types.update(
where={
'id': 1,
},
data={
'bool': True,
},
)
await client.types.update(
where={
'id': 1,
},
data=... | null |
163,026 | from prisma import Prisma
from prisma.enums import Role
async def filtering(client: Prisma) -> None:
# case: all valid filter fields
await client.types.find_first(
where={
'role': Role.USER,
},
) | null |
163,027 | from prisma import Prisma
from prisma.enums import Role
def use_str_enum_as_str():
# case: StrEnum is compatible with str typing
_test_string: str = Role.USER | null |
163,028 | from prisma import Prisma
from prisma.enums import Role
def raise_error_on_invalid_type():
_test_int: int = Role.USER # E: Expression of type "Literal[Role.USER]" cannot be assigned to declared type "int" | null |
163,029 | from datetime import datetime
from prisma import Prisma
async def filtering(client: Prisma) -> None:
# case: all valid filter fields
await client.types.find_first(
where={
'datetime': datetime.now(),
},
)
await client.types.find_first(
where={
'datetime':... | null |
163,030 | from datetime import datetime
from prisma import Prisma
async def updating(client: Prisma) -> None:
# case: setting
await client.types.update(
where={
'id': 1,
},
data={
'datetime': datetime.now(),
},
)
# case: invalid types
await client.type... | null |
163,031 | from prisma import Prisma
async def filtering(client: Prisma) -> None:
# case: all valid filter fields
await client.types.find_first(
where={
'string': 'foo',
},
)
await client.types.find_first(
where={
'string': {
'not': 'foo',
... | null |
163,032 | from prisma import Prisma
async def updating(client: Prisma) -> None:
# case: setting
await client.types.update(
where={
'id': 1,
},
data={
'string': 'foo',
},
)
await client.types.update(
where={
'id': 1,
},
da... | null |
163,033 | from prisma import Prisma
async def filtering(client: Prisma) -> None:
# case: all valid filter fields
await client.types.find_first(
where={
'float_': 237283,
},
)
await client.types.find_first(
where={
'float_': {
'not': 173283,
... | null |
163,034 | from prisma import Prisma
async def updating(client: Prisma) -> None:
# case: setting
await client.types.update(
where={
'id': 1,
},
data={
'float_': 290521015266836500,
},
)
await client.types.update(
where={
'id': 1,
... | null |
163,035 | from decimal import Decimal
from prisma import Prisma
async def filtering(client: Prisma) -> None:
# case: valid filter fields
await client.types.find_first(
where={
'decimal': Decimal('1'),
},
)
await client.types.find_first(
where={
'decimal': {
... | null |
163,036 | from datetime import datetime
from prisma import Prisma, Base64, Json
from prisma.enums import Role
async def filtering(client: Prisma) -> None:
# case: multiple arguments not allowed
await client.lists.find_first(
where={ # E: Argument of type "dict[str, dict[str, str | None]]" cannot be assigned to ... | null |
163,037 | from datetime import datetime
from prisma import Prisma, Base64, Json
from prisma.enums import Role
async def updating(client: Prisma) -> None:
# case: invalid set
await client.lists.update(
where={
'id': '',
},
data={
'strings': 'foo', # E: Argument of type "di... | null |
163,038 | from datetime import datetime
from prisma import Prisma, Base64, Json
from prisma.enums import Role
async def models(client: Prisma) -> None:
model = await client.lists.find_first()
assert model is not None
reveal_type(model.ints) # T: List[int]
reveal_type(model.roles) # T: List[Role]
reveal_typ... | null |
163,039 | from prisma import Prisma
async def nested_create(client: Prisma) -> None:
# TODO: test invalid cases
# case: valid nested create one-one
await client.post.create(
data={
'title': '',
'published': False,
'author': {
'create': {
... | null |
163,040 | from prisma import Prisma
The provided code snippet includes necessary dependencies for implementing the `one_to_one_relation` function. Write a Python function `async def one_to_one_relation(client: Prisma) -> None` to solve the following problem:
Ensure relational filters are strongly typed with pyright
Here is the... | Ensure relational filters are strongly typed with pyright |
163,041 | import argparse
import time
import typing
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import torch
from torch import nn
import torch.nn.functional as F
import torch.optim as optim
import higher
from support.omniglot_loaders import OmniglotNShot
def train(db, net, dev... | null |
163,042 | import argparse
import time
import typing
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
plt.style.use('bmh')
import torch
from torch import nn
import torch.nn.functional as F
import torch.optim as optim
import higher
from support.omniglot_loaders import OmniglotNShot
d... | null |
163,043 | import argparse
import typing
import torch
from torch import nn
from torch.utils.data import DataLoader
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
import higher
The provided code snippet includes necessary dependencies for implementing the `train` function.... | The training loop that optimizes the likelihood of a differentable model. Our model in this example internally unrolls gradient descent over an energy function in a differentiable way using higher and we can use the outputs of this model just as we use the outputs of any other differentiable model to optimize a loss fu... |
163,044 | import torchvision.transforms as transforms
from PIL import Image
import numpy as np
import torch
import torch.utils.data as data
import os
import os.path
import errno
def find_classes(root_dir):
retour = []
for (root, dirs, files) in os.walk(root_dir):
for f in files:
if (f.endswi... | null |
163,045 | import torchvision.transforms as transforms
from PIL import Image
import numpy as np
import torch
import torch.utils.data as data
import os
import os.path
import errno
def index_classes(items):
idx = {}
for i in items:
if i[1] not in idx:
idx[i[1]] = len(idx)
print("== Found %d... | null |
163,046 | import torch as _torch
import typing as _typing
def _copy_tensor(
t: _torch.Tensor,
safe_copy: bool,
device: _typing.Optional[_torch.device] = None
) -> _torch.Tensor:
if safe_copy:
t = t.clone().detach().requires_grad_(t.requires_grad)
else:
t = t.detach().requires_grad_(t.requires_... | null |
163,047 | import abc as _abc
from collections import OrderedDict as _OrderedDict
from contextlib import contextmanager as _contextmanager
import typing as _typing
import weakref as _weakref
import warnings as _warnings
import torch as _torch
from . import utils as _utils
class _MonkeyPatchBase(_abc.ABC, _torch.nn.Module):
de... | r"""Create a monkey-patched stateless version of a module. This function produces a monkey-patched version of a module, and returns a copy of its parameters for use as fast weights. Where the original module or any of its submodules have state (e.g. batch norm), this will be copied too, but further updates (e.g. during... |
163,048 | import abc as _abc
import collections as _collections
import copy as _copy
import math as _math
import typing as _typing
import warnings as _warnings
import torch as _torch
from . import patch as _patch
from . import utils as _utils
def _get_mask_closure(mask: _torch.Tensor) -> _GradClosureType:
def closure(grad: _... | null |
163,049 | import abc as _abc
import collections as _collections
import copy as _copy
import math as _math
import typing as _typing
import warnings as _warnings
import torch as _torch
from . import patch as _patch
from . import utils as _utils
_OverrideType = _typing.Dict[str, _typing.List[_typing.Any]]
class DifferentiableOptimi... | r"""Construct/initialize a differentiable version of an existing optimizer. Args: opt: an existing optimizer, assumed to be an instance of ``torch.optim.Optimizer``, of a supported type which is either defined in ``torch.optim``, or a custom implemantation which has been added to higher at runtime by using ``higher.reg... |
163,050 | import abc as _abc
import collections as _collections
import copy as _copy
import math as _math
import typing as _typing
import warnings as _warnings
import torch as _torch
from . import patch as _patch
from . import utils as _utils
_OverrideType = _typing.Dict[str, _typing.List[_typing.Any]]
class DifferentiableOptimi... | r"""Construct a differentiable version of an new optimizer. Args: opt_type: the type (constructor) for a torch.optim.Optimizer subtype from amongst the types supported by the library, or registered with it a runtime. opt_kwargs: a dictionary of keywords to be passed to the optimizer constructor. params (optional): a li... |
163,051 | import abc as _abc
import collections as _collections
import copy as _copy
import math as _math
import typing as _typing
import warnings as _warnings
import torch as _torch
from . import patch as _patch
from . import utils as _utils
class DifferentiableOptimizer(_abc.ABC):
def __init__(
self,
other:... | r"""Registers a new optimizer type for use with higher functions. Args: optim_type: the type of a new optimizer, assumed to be an instance of ``torch.optim.Optimizer``. diff_optim_type: the type of a new differentiable optimizer, assumed to be an instance of ``higher.optim.DifferentiableOptimizer`` with functionally eq... |
163,052 | import abc as _abc
import collections as _collections
import copy as _copy
import math as _math
import typing as _typing
import warnings as _warnings
import torch as _torch
from . import patch as _patch
from . import utils as _utils
_OverrideType = _typing.Dict[str, _typing.List[_typing.Any]]
The provided code snippet... | r"""Get an override dictionary from an optimizer instance. Args: opt: the optimizer to obtain an override dictionary from. device (optional): the device to cast the learnable tensors to. Returns: A dictionary of the format expected for the override kwarg of differentiable optimizers. It is initialized with trainable te... |
163,053 | import abc as _abc
import collections as _collections
import copy as _copy
import math as _math
import typing as _typing
import warnings as _warnings
import torch as _torch
from . import patch as _patch
from . import utils as _utils
_OverrideType = _typing.Dict[str, _typing.List[_typing.Any]]
def _recursive_apply(
... | r"""Apply learned hyperparameters back to original optimizer. Args: opt: the original optimizer. The hyperparameters in its parameter groups will be modified in place. override: dictionary of the format used for the override kwarg of differentiable optimizers. |
163,054 | import abc as _abc
import collections as _collections
import copy as _copy
import math as _math
import typing as _typing
import warnings as _warnings
import torch as _torch
from . import patch as _patch
from . import utils as _utils
def _add(
tensor: _torch.Tensor,
a1: _typing.Union[float, int, _torch.Tensor],... | null |
163,055 | import abc as _abc
import collections as _collections
import copy as _copy
import math as _math
import typing as _typing
import warnings as _warnings
import torch as _torch
from . import patch as _patch
from . import utils as _utils
def _addcdiv(
tensor: _torch.Tensor,
a1: _typing.Union[float, int, _torch.Tens... | null |
163,056 | import abc as _abc
import collections as _collections
import copy as _copy
import math as _math
import typing as _typing
import warnings as _warnings
import torch as _torch
from . import patch as _patch
from . import utils as _utils
def _addcmul(
tensor: _torch.Tensor,
a1: _typing.Union[float, int, _torch.Tens... | null |
163,057 | import os
import argparse
import logging
import pathlib
import tqdm
import random as python_random
from transformers import AutoModel, AutoConfig, AutoTokenizer
from modelscope.hub.snapshot_download import snapshot_download
from sqlova.model.nl2sql.wikisql_models import *
from sqlova.args import *
def construct_hyper_... | null |
163,058 | import os
import argparse
import logging
import pathlib
import tqdm
import random as python_random
from transformers import AutoModel, AutoConfig, AutoTokenizer
from modelscope.hub.snapshot_download import snapshot_download
from sqlova.model.nl2sql.wikisql_models import *
from sqlova.args import *
def mkdir(path):
... | null |
163,059 | import os
import argparse
import logging
import pathlib
import tqdm
import random as python_random
from transformers import AutoModel, AutoConfig, AutoTokenizer
from modelscope.hub.snapshot_download import snapshot_download
from sqlova.model.nl2sql.wikisql_models import *
from sqlova.args import *
def get_opt(model, m... | null |
163,060 | import os
import argparse
import logging
import pathlib
import tqdm
import random as python_random
from transformers import AutoModel, AutoConfig, AutoTokenizer
from modelscope.hub.snapshot_download import snapshot_download
from sqlova.model.nl2sql.wikisql_models import *
from sqlova.args import *
def get_bert(BERT_PT_... | null |
163,061 | import os
import argparse
import logging
import pathlib
import tqdm
import random as python_random
from transformers import AutoModel, AutoConfig, AutoTokenizer
from modelscope.hub.snapshot_download import snapshot_download
from sqlova.model.nl2sql.wikisql_models import *
from sqlova.args import *
def get_data(path_wi... | null |
163,062 | import os
import argparse
import logging
import pathlib
import tqdm
import random as python_random
from transformers import AutoModel, AutoConfig, AutoTokenizer
from modelscope.hub.snapshot_download import snapshot_download
from sqlova.model.nl2sql.wikisql_models import *
from sqlova.args import *
def train(train_load... | null |
163,063 | import os
import argparse
import logging
import pathlib
import tqdm
import random as python_random
from transformers import AutoModel, AutoConfig, AutoTokenizer
from modelscope.hub.snapshot_download import snapshot_download
from sqlova.model.nl2sql.wikisql_models import *
from sqlova.args import *
def tokenize_corenlp... | null |
163,064 | import os
import argparse
import logging
import pathlib
import tqdm
import random as python_random
from transformers import AutoModel, AutoConfig, AutoTokenizer
from modelscope.hub.snapshot_download import snapshot_download
from sqlova.model.nl2sql.wikisql_models import *
from sqlova.args import *
def tokenize_corenlp... | null |
163,065 | import os
import argparse
import logging
import pathlib
import tqdm
import random as python_random
from transformers import AutoModel, AutoConfig, AutoTokenizer
from modelscope.hub.snapshot_download import snapshot_download
from sqlova.model.nl2sql.wikisql_models import *
from sqlova.args import *
def print_result(epo... | null |
163,066 | import os
import argparse
import logging
import pathlib
import tqdm
import random as python_random
from transformers import AutoModel, AutoConfig, AutoTokenizer
from modelscope.hub.snapshot_download import snapshot_download
from sqlova.model.nl2sql.wikisql_models import *
from sqlova.args import *
def infer_get_data(p... | null |
163,067 | import os
import argparse
import logging
import pathlib
import tqdm
import random as python_random
from transformers import AutoModel, AutoConfig, AutoTokenizer
from modelscope.hub.snapshot_download import snapshot_download
from sqlova.model.nl2sql.wikisql_models import *
from sqlova.args import *
def infer_test(data_... | null |
163,068 | import os
import argparse
import logging
import pathlib
import tqdm
import random as python_random
from transformers import AutoModel, AutoConfig, AutoTokenizer
from modelscope.hub.snapshot_download import snapshot_download
from sqlova.model.nl2sql.wikisql_models import *
from sqlova.args import *
def infer_print_resu... | null |
163,069 | import os
import argparse
import logging
import pathlib
import tqdm
import random as python_random
from transformers import AutoModel, AutoConfig, AutoTokenizer
from modelscope.hub.snapshot_download import snapshot_download
from sqlova.model.nl2sql.wikisql_models import *
from sqlova.args import *
def convert_string(p... | null |
163,070 | from sqlova.args import *
from sqlova.utils.utils import topk_multi_dim
from sqlova.utils.utils_wikisql import *
def Loss_sa(s_sa, g_sa):
# w = torch.Tensor([1.0, 3.0, 3.0, 3.0, 3.0, 3.0]).to(device)
# loss = F.cross_entropy(s_sa, torch.tensor(g_sa).to(device), weight = w)
loss = F.cross_entropy(s_sa, torch... | :param s_wv: score [ B, n_conds, T, score] :param g_wn: [ B ] :param g_wvi: [B, conds, pnt], e.g. [[[0, 6, 7, 8, 15], [0, 1, 2, 3, 4, 15]], [[0, 1, 2, 3, 16], [0, 7, 8, 9, 16]]] :return: |
163,071 | from sqlova.args import *
from sqlova.utils.utils import topk_multi_dim
from sqlova.utils.utils_wikisql import *
def Loss_sc(s_sc, g_sc):
loss = F.cross_entropy(s_sc, torch.tensor(g_sc).to(device))
return loss
def Loss_sa(s_sa, g_sa):
# w = torch.Tensor([1.0, 3.0, 3.0, 3.0, 3.0, 3.0]).to(device)
# loss ... | :param s_wv: score [ B, n_conds, T, score] :param g_wn: [ B ] :param g_wvi: [B, conds, pnt], e.g. [[[0, 6, 7, 8, 15], [0, 1, 2, 3, 4, 15]], [[0, 1, 2, 3, 16], [0, 7, 8, 9, 16]]] :return: |
163,072 | from sqlova.args import *
from sqlova.utils.utils import topk_multi_dim
from sqlova.utils.utils_wikisql import *
The provided code snippet includes necessary dependencies for implementing the `Loss_s2s` function. Write a Python function `def Loss_s2s(score, g_pnt_idxs)` to solve the following problem:
score = [B, T, m... | score = [B, T, max_seq_length] |
163,074 | import os, json
import random as python_random
from matplotlib.pylab import *
The provided code snippet includes necessary dependencies for implementing the `ensure_dir` function. Write a Python function `def ensure_dir(my_path)` to solve the following problem:
Generate directory if not exists
Here is the function:
... | Generate directory if not exists |
163,075 | import os, json
import random as python_random
from matplotlib.pylab import *
def topk_multi_dim(tensor, n_topk=1, batch_exist=True):
if batch_exist:
idxs = []
for b, tensor1 in enumerate(tensor):
idxs1 = []
tensor1_1d = tensor1.reshape(-1)
values_1d, idxs_1d = ... | null |
163,076 | import os, json
import random as python_random
from matplotlib.pylab import *
import random
random.seed(33)
def load_jsonl(path_file, toy_data=False, toy_size=4, shuffle=False, seed=1):
data = []
with open(path_file, "r", encoding="utf-8") as f:
for idx, line in enumerate(f):
if toy_data... | null |
163,077 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def load_wikisql_data(pat... | null |
163,078 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def get_loader_wikisql(d... | null |
163,079 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def get_fields_1(t1, tabl... | null |
163,080 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def words_to_idx(words, w... | Zero-padded when word is not available (teated as <UNK>) Treat each "header tokens" as if they are NL-utterance tokens. |
163,081 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def encode(lstm, wemb_l, ... | null |
163,082 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def get_wc1(conds):
"... | for backward compatibility, separated with get_g |
163,083 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def get_g_wvi_corenlp(t)... | null |
163,084 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def generate_w2i_wemb_tab... | null |
163,085 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def update_w2i_wemb(word,... | Generate subset of TAPI from english-to-korean dict of table headers etc.. update_w2i_wemb. It uses wv, w2i, wemb, idx_w2i as global variables. To do 1. What should we do with the numeric? Current version do not treat them specially. But this would be modified later so that we can use tags. |
163,086 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def tokenize_nlu1(tokeni... | null |
163,087 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def tokenize_hds1(tokeni... | null |
163,088 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def gen_l_hpu(i_hds):
... | s2s version. Treat SQL-tokens as pseudo-headers sql_vocab = ("sql select", "sql where", "sql and", "sql equal", "sql greater than", "sql less than") e.g.) Q: What is the name of the player with score greater than 15? H: Name of the player, score Input: [CLS], what, is, ..., [SEP], name, of, the, player, [SEP], score, [... |
163,089 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def get_bert_output_agg(m... | null |
163,090 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def get_bert_output(model... | null |
163,091 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
device = torch.device("c... | Generate one-hot idx indicating vectors with their lenghts. :param g_wvi: e.g. [[[0, 6, 7, 8, 15], [0, 1, 2, 3, 4, 15]], [[0, 1, 2, 3, 16], [0, 7, 8, 9, 16]]] where_val idx in nlu_t. 0 = <BEG>, -1 = <END>. :param mL_w: 4 :param mL_nt: 200 :return: |
163,092 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
The provided code snippe... | return: [ pr_wc1_i, pr_wc2_i, ...] |
163,093 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
The provided code snippe... | return: [ pr_wc1_i, pr_wc2_i, ...] |
163,094 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
The provided code snippe... | return: [ pr_wc1_i, pr_wc2_i, ...] ! Returned index is sorted by prob. All colume-indexes are returned here. |
163,095 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
The provided code snippe... | s_wv: [B, 4, mL, 2] - predict best st-idx & ed-idx output: pr_wvi_beam = [B, max_wn, n_pairs, 2]. 2 means [st, ed]. prob_wvi_beam = [B, max_wn, n_pairs] |
163,096 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def is_whitespace_g_wvi(... | null |
163,097 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
The provided code snippe... | - Convert to the string in whilte-space-separated tokens - Add-hoc addition. |
163,098 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def pred_sa(s_sa):
""... | null |
163,099 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def pred_sc(s_sc):
""... | null |
163,100 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def find_sql_where_op(gt_... | Generate SQuAD style start and end index of wv in nlu. Index is for of after WordPiece tokenization. Assumption: where_str always presents in the nlu. |
163,101 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def get_amr_infos(t, l_n... | null |
163,102 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
The provided code snippe... | Generate SQuAD style start and end index of wv in nlu. Index is for of after WordPiece tokenization. Assumption: where_str always presents in the nlu. |
163,103 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def find_sql_where_op(gt_... | Generate SQuAD style start and end index of wv in nlu. Index is for of after WordPiece tokenization. Assumption: where_str always presents in the nlu. |
163,104 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def get_cnt_sc(g_sc, pr_s... | usalbe only when g_wc was used to find pr_wv |
163,105 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def get_cnt_sc_list(g_sc,... | usalbe only when g_wc was used to find pr_wv |
163,106 | import json
from copy import deepcopy
from matplotlib.pylab import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os
from .utils import generate_perm_inv
from .utils import json_default_type_checker
from sqlova.args import device
def get_cnt_sc_list(g_sc,... | usalbe only when g_wc was used to find pr_wv |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.