简体   繁体   English

使用 simpletransformers 时如何在 wandb 中记录工件?

[英]How to log artifacts in wandb while using saimpletransformers?

I am creating a Question Answering model using simpletransformers .我正在使用simpletransformers创建一个问答模型。 I would also like to use wandb to track model artifacts.我还想使用 wandb 来跟踪模型工件。 As I understand from wandb docs , there is an integration touchpoint for simpletransformers but there is no mention of logging artifacts.正如我从wandb docs了解到的, simpletransformers有一个集成接触点,但没有提到记录工件。

I would like to log artifacts generated at the train, validation, and test phase such as train.json, eval.json, test.json, output/nbest_predictions_test.json and best performing model.我想记录在训练、验证和测试阶段生成的工件,例如 train.json、eval.json、test.json、output/nbest_predictions_test.json 和最佳性能模型。

Currently simpleTransformers doesn't support logging artifacts within the training/testing scripts.目前 simpleTransformers 不支持在训练/测试脚本中记录工件。 But you can do it manually:但是你可以手动完成:

import os 

with wandb.init(id=model.wandb_run_id, resume="allow", project=wandb_project) as training_run:
    for dir in sorted(os.listdir("outputs")):
        if "checkpoint" in dir:
            artifact = wandb.Artifact("model-checkpoints", type="checkpoints")
            artifact.add_dir("outputs" + "/" + dir)
            training_run.log_artifact(artifact)

For more info, you can follow along with the W&B notebook in the SimpleTransofrmer's README.md有关更多信息,您可以跟随 SimpleTransofrmer 的 README.md 中的 W&B 笔记本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 多个用户输入整数的 While 循环 - While Loop of multiple user-inputted integers LOCF 插补以及如何填写缺失的条目 - LOCF imputation and how to fill missing entries RASA 响应选择器:如何回复多行文本? - RASA Response Selectors: How to reply multiline texts? 重构这个检查 Double 有多少小数的糟糕代码 - Refactor this terrible code that checks how many decimals a Double has 如何为大文本添加池化层到 BERT QA - How to add pooling layer to BERT QA for large text 如何在 google colab 上运行“run_squad.py”? 它给出了“无效语法”错误 - How to run 'run_squad.py' on google colab? It gives 'invalid syntax' error (TF-IDF)计算余弦相似度后如何返回五篇相关文章 - (TF-IDF)How to return the five related article after calculating cosine similarity AttributeError: 'str' object 在从 simpletransformers 训练 QuestionAnsweringModel 时没有属性 'to' - AttributeError: 'str' object has no attribute 'to' while training QuestionAnsweringModel from simpletransformers KeyError:使用 Huggingface Transformers 使用 BioASQ 数据集时出现“答案”错误 - KeyError: 'answers' error when using BioASQ dataset using Huggingface Transformers 使用NLP的知识库文章问答 - Q&A on KB Articles using NLP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM