-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于创建数据处理函数问题 #93
Comments
这个貌似是个python编程问题?可以参考
https://stackoverflow.com/questions/11291242/python-dynamically-create-function-at-runtime
…On Thu, Nov 11, 2021, 16:26 DataAnalysist ***@***.***> wrote:
如题,如果我有多个任务:A、B、C、D那是不是需要创建多个类似A_cls这样的装饰器函数,如下所示:
@preprocessing_fn
def A_cls(params, mode):
# get data
# your work
return input_list, target_list
能否根据具体任务动态的创建数据处理函数呢
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#93>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADS2OTDJATZOX7AXIHTQ4V3ULN44JANCNFSM5HZ33S4Q>
.
|
创建单任务数据处理函数def create_fn(problem_list):
like this? |
嗯, 看起来差不多, 可能这样构造会好一点 def create_preproc_fns(problem: str) -> Callable:
@preprocessing_fn
def example_cls(params, mode):
train_texts, train_labels = [], []
test_texts, test_labels = [],[]
# 训练模型
if (mode == TRAIN):
input_list = train_texts
target_list = train_labels
else:
input_list = test_texts
target_list = test_labels
return input_list, target_list
example_cls.__name__ = problem
return example_cls
fn_list = [create_preproc_fns(problem) for problem in ['a', 'b', 'c']] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如题,如果我有多个任务:A、B、C、D那是不是需要创建多个类似A_cls这样的装饰器函数,如下所示:
@preprocessing_fn
def A_cls(params, mode):
# get data
# your work
return input_list, target_list
能否根据具体任务动态的创建数据处理函数呢
The text was updated successfully, but these errors were encountered: