fastNLP
fastNLP copied to clipboard
fastNLP: A Modularized and Extensible NLP Framework. Currently still in incubation.
您好,我是用BertEmbedding,模型使用cn(chinese-bert-wwm),输入分好的词,是不是可以这样做,这样可以得到分词的向量,还是说必须基于字符进行输入.因为我的下游任务需要分好词的向量,如果必须要字符的话,那词向量如何获得.
**Describe the bug** A clear and concise description of what the bug is. 1. DistTrainer 和 Trainer 不仅是分布式与独立训练的差异,对各种原生callback的支持存在显著不同。 建议增加文档说明各原生callback对两个trainer的支持情况,毕竟有些callback要在若干个epoch运行以后才会触发bug; 2. (Dist)trainer,指定save path后保存模型,不能指定仅保存参数,而保存完整模型容易触发pickling error; **To Reproduce** Steps to reproduce the behavior:...
尊敬的fastNLP的作者你们好,最近在调研NLP框架,以用于公司后续的NLP任务。fastNLP的代码结构清晰,文档建设也比较完善,感谢作者们的开源。 在粗略看了fastNLP和allenNLP的架构后,发现在数据集加载和与数据集表示,以及框架整体设计上,两者有很多相通之处,比如都采用tabular的方式来表示数据,模块划分也类似。 能否麻烦fastNLP的作者帮忙对比,相对AllenNLP,fastNLP的主要优势在哪里?感谢!
在使用 nn.DistributedDataParallel 时,模型会被复制到所有使用的GPU,通常每个GPU上存有一个模型,并被一个单独的进程控制。这样有N块GPU,就会产生N个进程。当训练一个batch时,这一batch会被分为N份,每个进程会使用batch的一部分进行训练,然后在必要时进行同步,并通过网络传输需要同步的数据。 教程中这段话中“当训练一个batch时,这一batch会被分为N份,每个进程会使用batch的一部分进行训练,然后在必要时进行同步,并通过网络传输需要同步的数据。”我觉得不是这样。谈谈自己的理解:我觉得 pytorch的DDP多卡分发数据的时候应该是将Dataset分成N份,然后每个进程从自己分到的数据中抽取batch size进行训练。 不知道这样理解是不是对的。
HuggingFace的Transformers上提供了大量SOTA的NLP预训练模型,包括很多先进的tiny模型。 可以作为fastNLP的embeddings导入(类似已有的BERT),但是目前没有办法直接使用,可否提供相应的API呢? 写了一段代码尝试了Albert的导入,下游任务使用了BertForSentenceMatching: ``` from torch import nn from transformers import BertTokenizer, AlbertModel class AlbertEmbedding(nn.Module): def __init__(self, tokenizer, model): super(AlbertEmbedding, self).__init__() self.tokenizer = tokenizer self.model = model self.model.include_cls_sep = True...
PackagesNotFoundError: The following packages are not available from current channels: - fastnlp Current channels: - https://conda.anaconda.org/conda-forge/win-64 - https://conda.anaconda.org/conda-forge/noarch - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/win-64 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/noarch - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/noarch - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/win-64 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch...
fastnlp最近是不是更新了?我之前有个模型的测试集pre和rec卡在80%一直上不去,更新后直接升到98%
requests.exceptions.ConnectionError: HTTPConnectionPool(host='212.129.155.247', port=80): Max retries exceeded with url: /embedding/cn_tri_fastnlp_100d.zip (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',)) Connection Error
**疑似使用crf模块会遇到bug,希望大神帮忙看看,应该怎么解决,谢谢!** **Describe the bug** **描述** - 1、使用bert+crf模块训练一个模型,保存为pth `torch.save(model, model_path)` - 2、试图将该模型转换到pt结构时,在crf模块处报错 ``` model = torch.load("{}/{}".format(model_path, model_file)) traced_script_module = torch.jit.trace(model, args) traced_script_module.save("{}/test.pt".format(model_path)) ``` **报错信息:** ``` Traceback (most recent call last): File...