fastnlp / fastNLP

fastNLP: A Modularized and Extensible NLP Framework. Currently still in incubation.
https://gitee.com/fastnlp/fastNLP
Apache License 2.0
3.07k stars 448 forks source link

HTTPError occurred while downloading embedding vector 'en-glove-840b-300d' #423

Closed PhSe-coder closed 2 years ago

PhSe-coder commented 2 years ago

Got error message while running following code from Part II: 使用预训练的静态embedding

import torch
from fastNLP.embeddings import StaticEmbedding
from fastNLP import Vocabulary

vocab = Vocabulary()
vocab.add_word_lst("this is a demo .".split())

embed = StaticEmbedding(vocab, model_dir_or_name='en-glove-840b-300d')

words = torch.LongTensor([[vocab.to_index(word) for word in "this is a demo .".split()]])  # 将文本转为index
print(embed(words).size())  # StaticEmbedding的使用和pytorch的nn.Embedding是类似的

Error message:

HTTPError: Status code:404. Fail to download from http://download.fastnlp.top/embedding/glove.840B.300d.zip.

yhcc commented 2 years ago

请到https://nlp.stanford.edu/projects/glove/ 这个网址下载,或者使用 https://nlp.stanford.edu/data/glove.840B.300d.zip 直接下载。