标签: flair

安装 python 包 Flair 时出错,关于 PyPI 中未托管的依赖包

我正在尝试安装flair. 执行以下命令时抛出以下错误:

pip install flair

ERROR: Packages installed from PyPI cannot depend on packages which are not also hosted on PyPI.
tiny-tokenizer depends on SudachiDict_core@ https://object-storage.tyo2.conoha.io/v1/nc_2520839e1f9641b08211a5c85243124a/sudachi/SudachiDict_core-20190927.tar.gz

我认为明确安装此软件包可能会修复错误,但事实并非如此。错误保持不变。SudachiDict-core 的安装版本如下: SudachiDict-core 0.0.0

下面是环境:

  • 操作系统:Windows 10
  • Python:3.6(64 位)

任何提示表示赞赏。谢谢!

笔记:

  • 安装天赋时的第一个障碍是torch包。安装 Torch 包后,它就得到了解决。错误如下所示: ERROR: Could not find a version that satisfies the requirement torch>=1.1.0 (from flair) (from verERROR: No matching distribution found for torch>=1.1.0 (from flair)

python pip python-3.x flair

5
推荐指数
2
解决办法
1810
查看次数

RuntimeError:预期所有张量都在同一设备上,但发​​现至少有两个设备,cuda:0 和 cpu


import asyncio
import torch
import os
import pandas as pd
from flair.data import Sentence
from flair.embeddings import FlairEmbeddings, DocumentPoolEmbeddings, WordEmbeddings



device = torch.device("cpu")
print(device)
# first, declare how you want to embed
embeddings = DocumentPoolEmbeddings(
    [WordEmbeddings('glove'), FlairEmbeddings('news-forward'), FlairEmbeddings('news-backward')])


path = os.getcwd()

df=pd.read_pickle(path+'/embedding_all_courses_2.pkl')



query_emd=[]
cos = torch.nn.CosineSimilarity(dim=0, eps=1e-6)



query= Sentence("some text")
embeddings.embed([query])
query_emd.append(query.embedding)



async def count(index,row):
    for i in query_emd:
        print(words,row['course_name'],cos(i, row['embedding']))
        
    print(index)
    

async def main():
    await asyncio.gather(*(count(index,row) for index,row in df.iterrows()))


if __name__ == "__main__":
    import time
    s = time.perf_counter() …
Run Code Online (Sandbox Code Playgroud)

python cosine-similarity pytorch flair

5
推荐指数
0
解决办法
1万
查看次数

Flair 框架与 PyTorch - OverflowError: int 太大而无法转换

我正在尝试使用 Flair Framework(https://github.com/flairNLP/flair)训练命名实体识别模型,并使用以下嵌入:TransformerWordEmbeddings('emilyalsentzer/Bio_ClinicalBERT')。然而,它总是失败OverflowError: int too big to convert。这也发生在其他一些转换器词嵌入中,例如XLNet. 然而,BERT并且RoBERTa工作正常。

这是错误的完整回溯:

2021-04-15 09:34:48,106 ----------------------------------------------------------------------------------------------------
2021-04-15 09:34:48,106 Corpus: "Corpus: 778 train + 259 dev + 260 test sentences"
2021-04-15 09:34:48,106 ----------------------------------------------------------------------------------------------------
2021-04-15 09:34:48,106 Parameters:
2021-04-15 09:34:48,106  - learning_rate: "0.1"
2021-04-15 09:34:48,106  - mini_batch_size: "32"
2021-04-15 09:34:48,106  - patience: "3"
2021-04-15 09:34:48,106  - anneal_factor: "0.5"
2021-04-15 09:34:48,106  - max_epochs: "200"
2021-04-15 09:34:48,106  - shuffle: "True"
2021-04-15 09:34:48,106  - train_with_dev: "False"
2021-04-15 …
Run Code Online (Sandbox Code Playgroud)

python pytorch flair

5
推荐指数
1
解决办法
599
查看次数

标签 统计

flair ×3

python ×3

pytorch ×2

cosine-similarity ×1

pip ×1

python-3.x ×1