id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
39,058 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from utils import evaluate_NL2SQL, is_float
The provided code snippet includes necessary dependencies for implementing the `get_nestedSQL` function. Write a Python function `def get_nestedSQL(sql)` to solve the fol... | Args: Returns: |
39,059 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from utils import evaluate_NL2SQL, is_float
def eval_nested(pred, gold, value_match=True):
"""
Args:
Returns:
"""
gold_total = 0
pred_total = 0
cnt = 0
if pred is not None:
pr... | Args: Returns: |
39,060 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from utils import evaluate_NL2SQL, is_float
def get_keywords(sql):
"""
Args:
Returns:
"""
res = set()
if len(sql["where"]) > 0:
res.add("where")
if len(sql["groupBy"]) > 0:
... | Args: Returns: |
39,061 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from utils import evaluate_NL2SQL, is_float
def evaluate_complex(table, gold, predict, mode="exact", single_equal=False):
"""evaluate main
Args:
table (str): all tables file name
gold (str): ... | dataset:['CSpider', 'DuSQL', 'NL2SQL'] |
39,062 | import json
from text2sql.utils import metrics
def evaluate(model, dataset, infer_results, name="DuSQL", eval_value=True):
if name.lower() == "dusql":
metric = metrics.MetricDuSQLAcc(dataset, eval_value=eval_value)
else:
raise RuntimeError(f"only supports name DuSQL. but got {name}")
for i... | null |
39,063 | import collections
import itertools
import logging
import asdl
import attr
import networkx as nx
from text2sql.utils import ast_util
def bimap(first, second):
return {f: s for f, s in zip(first, second)}, {s: f for f, s in zip(first, second)} | null |
39,064 | import collections
import itertools
import logging
import asdl
import attr
import networkx as nx
from text2sql.utils import ast_util
def filter_nones(d):
return {k: v for k, v in d.items() if v is not None and v != []} | null |
39,065 | import collections
import itertools
import logging
import asdl
import attr
import networkx as nx
from text2sql.utils import ast_util
def join(iterable, delimiter):
it = iter(iterable)
yield next(it)
for x in it:
yield delimiter
yield x | null |
39,066 | import collections
import itertools
import logging
import asdl
import attr
import networkx as nx
from text2sql.utils import ast_util
def intersperse(delimiter, seq):
return itertools.islice(itertools.chain.from_iterable(zip(itertools.repeat(delimiter), seq)), 1, None) | null |
39,067 | import collections
import itertools
import asdl
import attr
import networkx as nx
from text2sql.utils import ast_util
def bimap(first, second):
return {f: s for f, s in zip(first, second)}, {s: f for f, s in zip(first, second)} | null |
39,068 | import collections
import itertools
import asdl
import attr
import networkx as nx
from text2sql.utils import ast_util
def filter_nones(d):
return {k: v for k, v in d.items() if v is not None and v != []} | null |
39,069 | import collections
import itertools
import asdl
import attr
import networkx as nx
from text2sql.utils import ast_util
def join(iterable, delimiter):
it = iter(iterable)
yield next(it)
for x in it:
yield delimiter
yield x | null |
39,070 | import collections
import itertools
import asdl
import attr
import networkx as nx
from text2sql.utils import ast_util
def intersperse(delimiter, seq):
return itertools.islice(itertools.chain.from_iterable(zip(itertools.repeat(delimiter), seq)), 1, None) | null |
39,075 | import argparse
import json
import logging
import os
import sys
from types import SimpleNamespace
import _jsonnet as jsonnet
def define_args_parser():
"""define command-line args parser"""
def _arg_bool(arg):
"""trans arg to bool type"""
if arg is None:
return arg
if type(arg... | read configs from file, and updating it by command-line arguments Args: config_path (TYPE): NULL Returns: TODO Raises: NULL |
39,076 | import logging
import sys
import numpy as np
import paddle
from text2sql.utils import nn_utils
The provided code snippet includes necessary dependencies for implementing the `collate_batch_data_v2` function. Write a Python function `def collate_batch_data_v2(origin_batch, config)` to solve the following problem:
forma... | format origin batch data for model forward |
39,077 | import json
import numpy as np
class SQL(object):
"""SQL define"""
op_sql_dict = {0: ">", 1: "<", 2: "==", 3: "!=", 4: ">=", 5: "<="}
agg_sql_dict = {0: "", 1: "AVG", 2: "MAX", 3: "MIN", 4: "COUNT", 5: "SUM"}
conn_sql_dict = {0: "", 1: "and", 2: "or"}
order_dict = {0: "", 1: "asc", 2: "desc"}
se... | encode sql |
39,078 | import json
import numpy as np
g_open_value_predict = False
def decode(
sel_num,
sel_col,
sel_agg,
where_num,
where_conn,
where_op,
where_op_prob,
col_value,
order_direction,
order_col,
order_agg,
limit_label,
group_num,
having_num,
group_col,
having_agg,
... | Generate sqls from model outputs |
39,079 | import json
import logging
import os
import pickle
import sys
from pathlib import Path
import attr
import networkx as nx
import paddle
import tqdm
from text2sql.utils import linking_utils, text_utils
class Column:
id = attr.ib()
table = attr.ib()
name = attr.ib()
orig_name = attr.ib()
dtype = attr.i... | load tables from json files |
39,080 | import json
import logging
import os
import traceback
import paddle
The provided code snippet includes necessary dependencies for implementing the `init_ernie_model` function. Write a Python function `def init_ernie_model(model_class, model_dir)` to solve the following problem:
init ernie model from static graph check... | init ernie model from static graph checkpoint |
39,081 | import re
import paddle
param_name_to_exclude_from_weight_decay = re.compile(r".*layer_norm_scale|.*layer_norm_bias|.*b_0")
def get_warmup_and_linear_decay(max_steps, warmup_steps):
"""ERNIE/demo/utils.py"""
return lambda step: min(step / warmup_steps, 1.0 - (step - warmup_steps) / (max_steps - warmup_steps))
... | null |
39,082 | import math
import paddle
import paddle.nn.functional as F
from paddle import nn
def _build_linear(n_in, n_out, name=None, init=None):
return nn.Linear(
n_in,
n_out,
weight_attr=paddle.ParamAttr(name="%s.w_0" % name if name is not None else None, initializer=init),
bias_attr="%s.b_0... | null |
39,083 | import math
import paddle
import paddle.nn.functional as F
from paddle import nn
def _build_ln(n_in, name):
return nn.LayerNorm(
normalized_shape=n_in,
weight_attr=paddle.ParamAttr(
name="%s_layer_norm_scale" % name if name is not None else None, initializer=nn.initializer.Constant(1.0)... | null |
39,084 | import math
import paddle
import paddle.nn.functional as F
from paddle import nn
def new_name(name, postfix):
if name is None:
ret = None
elif name == "":
ret = postfix
else:
ret = "%s_%s" % (name, postfix)
return ret | null |
39,085 | import math
import paddle
import paddle.nn.functional as F
from paddle import nn
The provided code snippet includes necessary dependencies for implementing the `relative_attention_logits` function. Write a Python function `def relative_attention_logits(query, key, relation)` to solve the following problem:
relative at... | relative attention logits(scores) Args: query (TYPE): NULL key (TYPE): NULL relation (TYPE): NULL Returns: Tensor, shape = [batch, heads, num queries, num kvs] Raises: NULL |
39,086 | import math
import paddle
import paddle.nn.functional as F
from paddle import nn
The provided code snippet includes necessary dependencies for implementing the `relative_attention_values` function. Write a Python function `def relative_attention_values(weight, value, relation)` to solve the following problem:
In this ... | In this version, relation vectors are shared across heads. Args: weight: [batch, heads, num queries, num kvs]. value: [batch, heads, num kvs, depth]. relation: [batch, num queries, num kvs, depth]. Returns: Tensor, shape = [batch, heads, num queries, depth] |
39,087 | import math
import numpy as np
import paddle
import paddle.nn.functional as F
def maybe_mask(attn, attn_mask):
if attn_mask is not None:
assert all(
a == 1 or b == 1 or a == b for a, b in zip(attn.shape[::-1], attn_mask.shape[::-1])
), f"Attention mask shape {attn_mask.shape} should be ... | null |
39,088 | import math
import numpy as np
import paddle
import paddle.nn.functional as F
The provided code snippet includes necessary dependencies for implementing the `attention` function. Write a Python function `def attention(query, key, value, mask=None, dropout=None)` to solve the following problem:
Compute 'Scaled Dot Prod... | Compute 'Scaled Dot Product Attention |
39,089 | import operator
import attr
import networkx as nx
from text2sql.dataproc.sql_preproc_v2 import get_field_presence_info
from text2sql.models.beam_search import Hypothesis
from text2sql.models.sql_decoder.decoder import TreeState
class Hypothesis:
inference_state = attr.ib()
next_choices = attr.ib()
score = ... | null |
39,090 | import operator
import attr
import networkx as nx
from text2sql.dataproc.sql_preproc_v2 import get_field_presence_info
from text2sql.models.beam_search import Hypothesis
from text2sql.models.sql_decoder.decoder import TreeState
def get_field_presence_info(ast_wrapper, node, field_infos):
"""get_field_presence_info... | null |
39,091 | import numpy as np
import paddle
The provided code snippet includes necessary dependencies for implementing the `compute_align_loss` function. Write a Python function `def compute_align_loss(model, desc_enc, example)` to solve the following problem:
model: a nl2code decoder
Here is the function:
def compute_align_lo... | model: a nl2code decoder |
39,092 | import numpy as np
import paddle
The provided code snippet includes necessary dependencies for implementing the `compute_pointer_with_align` function. Write a Python function `def compute_pointer_with_align(model, node_type, prev_state, prev_action_emb, parent_h, parent_action_emb, desc_enc)` to solve the following pr... | compute_pointer_with_align |
39,093 | import copy
import itertools
import attr
import paddle
import paddle.nn.functional as F
from text2sql.dataproc import sql_preproc_v2, vocab
from text2sql.models import attention
from text2sql.models.sql_decoder import align_dec_func
from text2sql.models.sql_decoder.infer_tree_traversal import InferenceTreeTraversal
fro... | null |
39,094 | import copy
import itertools
import attr
import paddle
import paddle.nn.functional as F
from text2sql.dataproc import sql_preproc_v2, vocab
from text2sql.models import attention
from text2sql.models.sql_decoder import align_dec_func
from text2sql.models.sql_decoder.infer_tree_traversal import InferenceTreeTraversal
fro... | null |
39,095 | import re
from collections import defaultdict
from statistics import mean
import cn2an
from LAC import LAC
lac = lambda sentence: g_lac_lac.run(sentence)
EMPTY_TAG = "o"
The provided code snippet includes necessary dependencies for implementing the `ner` function. Write a Python function `def ner(sentence)` to solve t... | wordseg and ner Args: sentence (TYPE): NULL Returns: TODO Raises: NULL |
39,096 | import re
from collections import defaultdict
from statistics import mean
import cn2an
from LAC import LAC
The provided code snippet includes necessary dependencies for implementing the `remove_brackets` function. Write a Python function `def remove_brackets(s)` to solve the following problem:
Remove brackets [] () fr... | Remove brackets [] () from text |
39,097 | import re
from collections import defaultdict
from statistics import mean
import cn2an
from LAC import LAC
The provided code snippet includes necessary dependencies for implementing the `str_to_year` function. Write a Python function `def str_to_year(string)` to solve the following problem:
str to year
Here is the fu... | str to year |
39,098 | import re
from collections import defaultdict
from statistics import mean
import cn2an
from LAC import LAC
wordseg = lambda sentence: g_lac_seg.run(sentence)
def _extract_num_span(text):
"""extract number and mark their spans
Args:
text (TYPE): NULL
Returns: TODO
Raises: NULL
"""
dct_sta... | null |
39,099 | import logging
import time
The provided code snippet includes necessary dependencies for implementing the `list_increment` function. Write a Python function `def list_increment(lst: list, base: int)` to solve the following problem:
increment each element in list
Here is the function:
def list_increment(lst: list, ba... | increment each element in list |
39,100 | import logging
import time
def count_file_lines(filename):
cnt = 0
with open(filename) as ifs:
for _ in ifs:
cnt += 1
return cnt | null |
39,101 | import logging
import time
The provided code snippet includes necessary dependencies for implementing the `print_tensors` function. Write a Python function `def print_tensors(tag="*", **kwargs)` to solve the following problem:
print tensors for debugging
Here is the function:
def print_tensors(tag="*", **kwargs):
... | print tensors for debugging |
39,102 | import itertools
import logging
import re
import numpy as np
from text2sql.utils import text_utils
g_linking_ngrams_n = 5
STOPWORDS = set(
[
"的",
"是",
",",
"?",
"有",
"多少",
"哪些",
"我",
"什么",
"你",
"知道",
"啊",
"一下",
... | schema linking |
39,103 | import itertools
import logging
import re
import numpy as np
from text2sql.utils import text_utils
STOPWORDS = set(
[
"的",
"是",
",",
"?",
"有",
"多少",
"哪些",
"我",
"什么",
"你",
"知道",
"啊",
"一下",
"吗",
"在"... | cell-value linking |
39,104 | import itertools
import logging
import re
import numpy as np
from text2sql.utils import text_utils
def clamp(value, abs_max):
"""clamp value"""
value = max(-abs_max, value)
value = min(abs_max, value)
return value
RELATIONS = Relations()
def _table_id(db, col):
if col == 0:
return None
e... | build relation matrix |
39,105 |
The provided code snippet includes necessary dependencies for implementing the `to_dict_with_sorted_values` function. Write a Python function `def to_dict_with_sorted_values(d, key=None)` to solve the following problem:
to dict with sorted values
Here is the function:
def to_dict_with_sorted_values(d, key=None):
... | to dict with sorted values |
39,106 |
The provided code snippet includes necessary dependencies for implementing the `to_dict_with_set_values` function. Write a Python function `def to_dict_with_set_values(d)` to solve the following problem:
to dict with set values
Here is the function:
def to_dict_with_set_values(d):
"""to dict with set values"""
... | to dict with set values |
39,107 |
The provided code snippet includes necessary dependencies for implementing the `tuplify` function. Write a Python function `def tuplify(x)` to solve the following problem:
tuplify
Here is the function:
def tuplify(x):
"""tuplify"""
if not isinstance(x, (tuple, list)):
return x
return tuple(tupli... | tuplify |
39,108 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
def load_data(fpath):
with open(fpath) as f:
data = json.load(f)
return data | null |
39,109 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
def tokenize(string):
"""
Args:
Returns:
"""
string = string.replace("'", '"').lower()
assert string.count('"') % 2 == 0, "Unexpected quote"
def _ext... | null |
39,110 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
The provided code snippet includes necessary dependencies for implementing the `get_scores` function. Write a Python function `def get_scores(count, pred_total, gold_total)` to... | Args: Returns: |
39,111 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
The provided code snippet includes necessary dependencies for implementing the `eval_sel` function. Write a Python function `def eval_sel(pred, gold)` to solve the following pr... | Args: Returns: |
39,112 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
def eval_cond(pred, gold):
def eval_where(pred, gold):
pred_conds = list(sorted([unit for unit in pred["where"][::2]], key=lambda x: [str(i) for i in x]))
gold_conds = ... | null |
39,113 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
def eval_group(pred, gold):
pred_cols = [unit[1] for unit in pred["groupBy"]]
gold_cols = [unit[1] for unit in gold["groupBy"]]
pred_total = len(pred_cols)
gold... | null |
39,114 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
def eval_cond(pred, gold):
def _equal(p, g):
if str(p) == str(g):
return True
p = p.strip("\"'") if type(p) is str else p
g = g.strip("\"... | and/or will be evaluate in other branch |
39,115 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
def eval_order(pred, gold):
pred_total = gold_total = cnt = 0
if len(pred["orderBy"]) > 0:
pred_total = 1
if len(gold["orderBy"]) > 0:
gold_total = ... | null |
39,116 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
def eval_and_or(pred, gold):
def _extract(conds):
"""extract condition and/or"""
op_set = set()
for i in range(1, len(conds) - 1, 2):
le... | null |
39,117 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
def get_nestedSQL(sql):
nested = []
for cond_unit in sql["from"]["conds"][::2] + sql["where"][::2] + sql["having"][::2]:
if type(cond_unit[3]) is dict:
... | null |
39,118 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
def eval_nested(pred, gold):
gold_total = 0
pred_total = 0
cnt = 0
if pred is not None:
pred_total += 1
if gold is not None:
gold_total += 1
... | null |
39,119 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
def get_keywords(sql):
res = set()
if len(sql["where"]) > 0:
res.add("where")
if len(sql["groupBy"]) > 0:
res.add("group")
if len(sql["having"]) ... | null |
39,120 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
TABLE_TYPE = {
"sql": "sql",
"table_unit": "table_unit",
}
def build_valid_col_units(table_units, schema):
col_ids = [table_unit[1] for table_unit in table_units if... | null |
39,121 | import copy
import json
import logging
import re
from collections import defaultdict
from io import open
from text2sql.utils import text_utils
def build_foreign_key_map(entry):
cols_orig = entry["column_names_original"]
tables_orig = entry["table_names_original"]
# rebuild cols corresponding to idmap in Sch... | null |
39,122 | import numpy as np
import paddle
from paddle import nn
import paddle
paddle.framework.io.EagerParamBase.to = to
def build_linear(n_in, n_out, name=None, init=None):
return nn.Linear(
n_in,
n_out,
weight_attr=paddle.ParamAttr(name="%s.w_0" % name if name is not None else None, initializer... | null |
39,123 | import numpy as np
import paddle
from paddle import nn
import paddle
paddle.framework.io.EagerParamBase.to = to
def build_layer_norm(n_in, name):
return nn.LayerNorm(
normalized_shape=n_in,
weight_attr=paddle.ParamAttr(
name="%s_layer_norm_scale" % name if name is not None else None,... | null |
39,124 | import numpy as np
import paddle
from paddle import nn
import paddle
paddle.framework.io.EagerParamBase.to = to
def lstm_init(num_layers, hidden_size, *batch_sizes):
init_size = batch_sizes + (hidden_size,)
if num_layers is not None:
init_size = (num_layers,) + init_size
init = paddle.zeros(init... | null |
39,125 | import numpy as np
import paddle
from paddle import nn
import paddle
paddle.framework.io.EagerParamBase.to = to
The provided code snippet includes necessary dependencies for implementing the `batch_gather_2d` function. Write a Python function `def batch_gather_2d(var, indices)` to solve the following problem:
Gathe... | Gather slices from var in each batch, according to corresponding index in indices. Currently, it only support 2d Tensor. Args: var (Variable): with shape [batch_size, ...] indices (Variable): with shape [batch_size, max_len] Returns: Variable with shape [batch_size] Raises: NULL Examples: var [[1, 2, 3], [4, 5, 6]] ind... |
39,126 | import numpy as np
import paddle
from paddle import nn
import paddle
paddle.framework.io.EagerParamBase.to = to
The provided code snippet includes necessary dependencies for implementing the `sequence_mask` function. Write a Python function `def sequence_mask(seq_hidden, mask, mode="zero")` to solve the following p... | Args: seq_hidden (Tensor): NULL mask (Tensor): 1 for un-mask tokens, and 0 for mask tokens. mode (str): zero/-inf/+inf Returns: TODO Raises: NULL |
39,127 | import numpy as np
import paddle
from paddle import nn
The provided code snippet includes necessary dependencies for implementing the `pad_sequences_for_3d` function. Write a Python function `def pad_sequences_for_3d(seqs, max_col, max_num, dtype=np.int64)` to solve the following problem:
padding sequences for 3d
Her... | padding sequences for 3d |
39,128 | import numpy as np
import paddle
from paddle import nn
The provided code snippet includes necessary dependencies for implementing the `pad_index_sequences` function. Write a Python function `def pad_index_sequences(seqs, max_col, max_row, dtype=np.int64)` to solve the following problem:
padding sequences for column to... | padding sequences for column token indexes |
39,129 | import numpy as np
import paddle
from paddle import nn
import paddle
paddle.framework.io.EagerParamBase.to = to
def tensor2numpy(inputs):
if type(inputs) in (list, tuple):
return [x.numpy() for x in inputs]
elif type(inputs) is dict:
outputs = {}
for key, value in inputs.items():
... | null |
39,130 | import math
from dataclasses import dataclass, field
from functools import partial
from itertools import chain
from typing import Optional
import paddle
import paddle.nn as nn
from datasets import load_dataset
from paddlenlp.data import DataCollatorWithPadding
from paddlenlp.trainer import PdArgumentParser, Trainer, Tr... | null |
39,131 | import random
import string
import time
import paddle
import uvicorn
from fastapi import FastAPI, Response, status
from pydantic import BaseModel
from sse_starlette.sse import EventSourceResponse
from paddlenlp.transformers import CodeGenForCausalLM, CodeGenTokenizer
from paddlenlp.utils.log import logger
class Input(B... | null |
39,132 | from __future__ import annotations
import argparse
import json
import math
import re
import time
from pprint import pprint as print
import numpy as np
import paddle
from paddle.distributed import fleet
from paddle.io import DataLoader
from paddlenlp.data import Stack, Tuple
from paddlenlp.transformers import AutoModelF... | null |
39,133 | import argparse
import time
import paddle
from paddlenlp.transformers import AutoModelForCausalLM, AutoTokenizer
The provided code snippet includes necessary dependencies for implementing the `parse_args` function. Write a Python function `def parse_args(prog=None)` to solve the following problem:
parse_args
Here is ... | parse_args |
39,134 | import argparse
import time
import paddle
from paddlenlp.transformers import AutoModelForCausalLM, AutoTokenizer
def predict_generate(model, inputs):
for i in range(10):
start = time.perf_counter()
result = model.generate(
**inputs,
max_length=100,
decode_strateg... | null |
39,135 | import argparse
import time
import paddle
from paddlenlp.transformers import AutoModelForCausalLM, AutoTokenizer
def predict_forward(model, inputs):
for i in range(10):
start = time.perf_counter()
_ = model(**inputs)
hf_cost = (time.perf_counter() - start) * 1000
print("Speed test:"... | null |
39,136 | import argparse
import time
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
The provided code snippet includes necessary dependencies for implementing the `parse_args` function. Write a Python function `def parse_args(prog=None)` to solve the following problem:
parse_args
Here is the functio... | parse_args |
39,137 | import argparse
import time
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
def predict_generate(model, inputs):
for i in range(10):
start = time.perf_counter()
generate_ids = model.generate(
inputs.input_ids,
max_length=100,
do_sample=F... | null |
39,138 | import argparse
import time
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
def predict_forward(model, inputs):
for i in range(10):
start = time.perf_counter()
_ = model(**inputs)
hf_cost = (time.perf_counter() - start) * 1000
print("Speed test:", hf_cost) | null |
39,139 | import os
import subprocess
import sys
import time
from collections import defaultdict
from pynvml import (
nvmlDeviceGetCount,
nvmlDeviceGetHandleByIndex,
nvmlDeviceGetMemoryInfo,
nvmlInit,
)
def get_mrc_tasks(model_name_or_path):
learning_rate_list = [1e-5, 2e-5, 3e-5]
batch_size_list = [32, ... | null |
39,140 | import os
import subprocess
import sys
import time
from collections import defaultdict
from pynvml import (
nvmlDeviceGetCount,
nvmlDeviceGetHandleByIndex,
nvmlDeviceGetMemoryInfo,
nvmlInit,
)
def get_cls_tasks(model_name_or_path):
learning_rate_list = [1e-5, 2e-5, 3e-5, 5e-5]
batch_size_list =... | null |
39,141 | import os
import subprocess
import sys
import time
from collections import defaultdict
from pynvml import (
nvmlDeviceGetCount,
nvmlDeviceGetHandleByIndex,
nvmlDeviceGetMemoryInfo,
nvmlInit,
)
mrc_device = {}
def get_availble(est=15, is_mrc=False):
# Sort handles according to info.free
handles.s... | null |
39,142 | import argparse
import contextlib
import distutils.util
import json
import os
import random
import time
import numpy as np
import paddle
from datasets import load_dataset
from paddle.io import DataLoader
from paddlenlp.data import DataCollatorWithPadding
from paddlenlp.metrics.squad import compute_prediction, squad_eva... | null |
39,143 | import argparse
import contextlib
import distutils.util
import json
import os
import random
import time
import numpy as np
import paddle
from datasets import load_dataset
from paddle.io import DataLoader
from paddlenlp.data import DataCollatorWithPadding
from paddlenlp.metrics.squad import compute_prediction, squad_eva... | null |
39,144 | import argparse
import contextlib
import distutils.util
import json
import os
import random
import time
import numpy as np
import paddle
from datasets import load_dataset
from paddle.io import DataLoader
from paddlenlp.data import DataCollatorWithPadding
from paddlenlp.metrics.squad import compute_prediction, squad_eva... | print arguments |
39,145 | import argparse
import contextlib
import json
import os
import random
import time
from functools import partial
import numpy as np
import paddle
from datasets import load_dataset
from paddlenlp.data import Dict, Pad, Stack
from paddlenlp.trainer.argparser import strtobool
from paddlenlp.transformers import (
AutoMo... | null |
39,146 | import argparse
import contextlib
import json
import os
import random
import time
from functools import partial
import numpy as np
import paddle
from datasets import load_dataset
from paddlenlp.data import Dict, Pad, Stack
from paddlenlp.trainer.argparser import strtobool
from paddlenlp.transformers import (
AutoMo... | null |
39,147 | import argparse
import contextlib
import json
import os
import random
import time
from functools import partial
import numpy as np
import paddle
from datasets import load_dataset
from paddlenlp.data import Dict, Pad, Stack
from paddlenlp.trainer.argparser import strtobool
from paddlenlp.transformers import (
AutoMo... | print arguments |
39,148 | import argparse
import contextlib
import json
import os
import random
import time
from functools import partial
import numpy as np
import paddle
import paddle.nn as nn
from datasets import load_dataset
from paddlenlp.data import Dict, Pad, Stack
from paddlenlp.trainer.argparser import strtobool
from paddlenlp.transform... | null |
39,149 | import argparse
import contextlib
import json
import os
import random
import time
from functools import partial
import numpy as np
import paddle
import paddle.nn as nn
from datasets import load_dataset
from paddlenlp.data import Dict, Pad, Stack
from paddlenlp.trainer.argparser import strtobool
from paddlenlp.transform... | null |
39,150 | import argparse
import contextlib
import json
import os
import random
import time
from functools import partial
import numpy as np
import paddle
import paddle.nn as nn
from datasets import load_dataset
from paddlenlp.data import Dict, Pad, Stack
from paddlenlp.trainer.argparser import strtobool
from paddlenlp.transform... | print arguments |
39,151 | import os
from dataclasses import dataclass, field
from functools import partial
from typing import Optional
import paddle
import paddle.nn as nn
from paddle.metric import Accuracy
from paddlenlp.data import DataCollatorWithPadding
from paddlenlp.datasets import load_dataset
from paddlenlp.trainer import (
PdArgume... | null |
39,152 | import argparse
import json
import math
import os
import random
import time
from functools import partial
import numpy as np
import paddle
import paddle.nn as nn
from paddle.io import DataLoader
from paddle.metric import Accuracy
from paddlenlp.data import DataCollatorWithPadding
from paddlenlp.datasets import load_dat... | null |
39,153 | import argparse
import json
import math
import os
import random
import time
from functools import partial
import numpy as np
import paddle
import paddle.nn as nn
from paddle.io import DataLoader
from paddle.metric import Accuracy
from paddlenlp.data import DataCollatorWithPadding
from paddlenlp.datasets import load_dat... | null |
39,154 | import argparse
import json
import math
import os
import random
import time
from functools import partial
import numpy as np
import paddle
import paddle.nn as nn
from paddle.io import DataLoader
from paddle.metric import Accuracy
from paddlenlp.data import DataCollatorWithPadding
from paddlenlp.datasets import load_dat... | null |
39,155 | import argparse
import json
import math
import os
import random
import time
from functools import partial
import numpy as np
import paddle
import paddle.nn as nn
from paddle.io import DataLoader
from paddle.metric import Accuracy
from paddlenlp.data import DataCollatorWithPadding
from paddlenlp.datasets import load_dat... | null |
39,156 | import argparse
import json
import math
import os
import random
import time
from functools import partial
import numpy as np
import paddle
import paddle.nn as nn
from paddle.io import DataLoader
from paddle.metric import Accuracy
from paddlenlp.data import DataCollatorWithPadding
from paddlenlp.datasets import load_dat... | print arguments |
39,157 | import argparse
import logging
import math
import os
import random
import time
from functools import partial
import numpy as np
import paddle
from paddle.io import DataLoader
from paddle.metric import Accuracy
from paddlenlp.data import Pad, Stack, Tuple
from paddlenlp.datasets import load_dataset
from paddlenlp.metric... | null |
39,158 | import argparse
import logging
import math
import os
import random
import time
from functools import partial
import numpy as np
import paddle
from paddle.io import DataLoader
from paddle.metric import Accuracy
from paddlenlp.data import Pad, Stack, Tuple
from paddlenlp.datasets import load_dataset
from paddlenlp.metric... | null |
39,159 | import argparse
import logging
import math
import os
import random
import time
from functools import partial
import numpy as np
import paddle
from paddle.io import DataLoader
from paddle.metric import Accuracy
from paddlenlp.data import Pad, Stack, Tuple
from paddlenlp.datasets import load_dataset
from paddlenlp.metric... | print arguments |
39,160 | import os
from dataclasses import dataclass, field
from functools import partial
from typing import Optional
import numpy as np
import paddle
from paddle.metric import Accuracy
from paddlenlp.data import DataCollatorWithPadding
from paddlenlp.datasets import load_dataset
from paddlenlp.metrics import AccuracyAndF1, Mcc... | convert a glue example into necessary features |
39,161 | import os
import random
import time
import numpy as np
from functools import partial
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
import paddle.distributed as dist
from paddle.io import DataLoader, DistributedBatchSampler, BatchSampler
from paddle.optimizer import AdamW
from paddle.metric impor... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.