Dataset Viewer
Auto-converted to Parquet Duplicate
word
stringlengths
1
1k
vector
listlengths
300
300
,
[ 0.1837799996137619, -0.12122999876737595, -0.11986999958753586, 0.01522700022906065, -0.19121000170707703, -0.06607399880886078, -2.987600088119507, 0.8079500198364258, 0.0673379972577095, -0.13184000551700592, -0.527400016784668, 0.4452100098133087, 0.12982000410556793, -0.218229994177818...
the
[ -0.20837999880313873, -0.14932000637054443, -0.017527999356389046, -0.028432000428438187, -0.06010400131344795, -0.26460000872612, -4.144499778747559, 0.6293200254440308, 0.33671998977661133, -0.4339500069618225, 0.3989900052547455, -0.19573000073432922, 0.1397700011730194, -0.021518999710...
.
[ 0.10875999927520752, 0.002243800088763237, 0.22213000059127808, -0.12101999670267105, -0.048958998173475266, 0.01813500002026558, -3.8173999786376953, -0.03263099864125252, -0.6259400248527527, -0.5189800262451172, -0.35892999172210693, 0.7887099981307983, -0.2977699935436249, 0.0051859999...
and
[ -0.09611000120639801, -0.25788000226020813, -0.358599990606308, -0.3288699984550476, 0.5795000195503235, -0.51774001121521, -4.158199787139893, -0.11371000111103058, -0.10847999900579453, -0.4888499975204468, 0.19931000471115112, -0.10540000349283218, -0.43825000524520874, -0.3448300063610...
to
[ -0.2483700066804886, -0.4546099901199341, 0.03922700136899948, -0.28422001004219055, -0.03185199946165085, 0.2635500133037567, -4.632299900054932, 0.013890000060200691, -0.5392799973487854, -0.0844539999961853, 0.061556000262498856, -0.4155200123786926, -0.14598999917507172, -0.59320998191...
of
[ -0.03642899915575981, -0.28591999411582947, 0.06338699907064438, -0.6012200117111206, -0.015309000387787819, 0.07324299961328506, -3.8547000885009766, 0.5280900001525879, -0.07785899937152863, -0.40755999088287354, 0.4471299946308136, 0.005626100115478039, -0.3888700008392334, -0.009204300...
a
[ -0.03583500161767006, 0.778439998626709, -0.518060028553009, 0.08068200200796127, -0.13173000514507294, -0.28606000542640686, -4.248499870300293, 0.8182700276374817, 0.240339994430542, -0.6905699968338013, 0.21556000411510468, -0.1243399977684021, -0.5422899723052979, -0.1513800024986267, ...
in
[ 0.06850700080394745, -0.023344000801444054, 0.2827099859714508, -0.4021500051021576, 0.07781500369310379, -0.027002999559044838, -3.7644999027252197, 0.41707998514175415, 0.05837300047278404, -0.06799700111150742, 0.3204500079154968, 0.09331700205802917, 0.3544600009918213, 0.2441499978303...
"
[ -0.0480320006608963, -0.6913999915122986, -0.21956999599933624, 0.08956799656152725, 0.2847200036048889, -1.0530999898910522, -3.412100076675415, 0.02696000039577484, -0.20036999881267548, -0.5309100151062012, 0.9705600142478943, -0.034644000232219696, -0.10033000260591507, -0.207100003957...
is
[ 0.11395999789237976, 0.3450300097465515, -0.05506400018930435, -0.20192000269889832, 0.20848000049591064, -0.09698999673128128, -4.023600101470947, 0.9504600167274475, -0.06080299988389015, -0.8325999975204468, 0.39127999544143677, 0.0808819979429245, 0.1904900074005127, -0.043595001101493...
for
[ -0.2390899956226349, -0.6418899893760681, -0.5832200050354004, -0.5474299788475037, 0.42386001348495483, -0.11755000054836273, -4.216899871826172, 0.2868500053882599, -0.3076600134372711, -0.6741999983787537, 0.038669999688863754, 0.23048000037670135, -0.15794000029563904, 0.18096999824047...
:
[ 0.1852400004863739, -0.37887001037597656, 0.2660300135612488, -0.5930100083351135, 0.6550700068473816, -0.08833199739456177, -2.510999917984009, 0.7791299819946289, -0.6028900146484375, -0.4287700057029724, 0.1688700020313263, 0.9855899810791016, -0.49094998836517334, 0.09100800007581711, ...
i
[ -0.04350399971008301, -0.18483999371528625, -0.14612999558448792, -0.21750999987125397, 0.20250000059604645, 0.04405299946665764, -4.282299995422363, -0.0349310003221035, 0.10337000340223312, -0.6893100142478943, 0.07892800122499466, -0.19808000326156616, 0.10098999738693237, -0.2190199941...
)
[ 0.26666998863220215, -0.2301499992609024, -0.01351999957114458, 0.10943000018596649, 0.7119699716567993, -0.09002500027418137, -2.5768001079559326, 0.8865900039672852, 0.21025000512599945, -0.3194800019264221, 0.5858799815177917, 0.6707900166511536, -0.1265300065279007, 0.31632000207901, ...
that
[ 0.15805000066757202, -0.26232999563217163, 0.17418000102043152, -0.16878999769687653, 0.13248999416828156, 0.0012131000403314829, -4.776199817657471, 0.2927800118923187, 0.06433799862861633, -0.5740399956703186, 0.009386200457811356, -0.11879999935626984, 0.027010999619960785, 0.0463690012...
(
[ 0.22565999627113342, -0.37112000584602356, -0.2154500037431717, -0.01641000062227249, 0.33052998781204224, -0.15234999358654022, -2.706399917602539, 0.9398400187492371, 0.20523999631404877, 0.14340999722480774, 0.7085300087928772, 0.5039600133895874, 0.10786999762058258, -0.157140001654624...
you
[ -0.04531500115990639, -0.010389000177383423, -0.19798000156879425, 0.0074069001711905, 0.1391499936580658, 0.28314998745918274, -4.857800006866455, 0.05972199887037277, -0.0419280007481575, -0.6795099973678589, -0.22934000194072723, -0.03704100102186203, 0.19497999548912048, -0.13720999658...
it
[ 0.394569993019104, -0.013387000188231468, -0.23288999497890472, -0.16009999811649323, 0.32787999510765076, -0.07188799977302551, -4.916600227355957, 0.4200200140476227, -0.07070399820804596, -0.7231400012969971, 0.09178300201892853, -0.30671000480651855, 0.2624500095844269, -0.092867001891...
on
[ 0.0006065699853934348, 0.04863100126385689, 0.48969000577926636, 0.4277699887752533, -0.38609999418258667, -0.008423100225627422, -3.6026999950408936, 0.4781099855899811, 0.04794500023126602, -0.318589985370636, -0.21334999799728394, -0.5153099894523621, -0.17141999304294586, -0.2003500014...
-
[ -0.2788099944591522, -0.4027099907398224, -0.18591000139713287, -0.27202001214027405, 0.2840900123119354, 0.25363999605178833, -2.5525999069213867, 0.12913000583648682, -0.5979899764060974, -0.6636800169944763, -0.21797999739646912, 1.154099941253662, -0.28387999534606934, 0.47288998961448...
with
[ -0.5059000253677368, -0.5483999848365784, 0.016063999384641647, -0.29580000042915344, -0.011176000349223614, -0.34264999628067017, -4.186200141906738, 0.2708899974822998, -0.12563000619411469, -0.8737900257110596, 0.27529001235961914, -0.15768000483512878, -0.17750999331474304, 0.148340001...
's
[ 0.48701000213623047, -0.263729989528656, -0.3062500059604645, 0.14684000611305237, 0.20305000245571136, -0.13640999794006348, -3.537600040435791, 0.5923799872398376, 0.21657000482082367, -1.4112999439239502, 0.4543299973011017, -0.18998999893665314, -0.14233000576496124, -0.057544000446796...
this
[ 0.1922300010919571, 0.28554001450538635, 0.012628999538719654, -0.22883999347686768, 0.9405199885368347, -0.3627699911594391, -4.309800148010254, 0.3285300135612488, -0.5995000004768372, -0.5773100256919861, 0.21548999845981598, -0.043195001780986786, -0.07955999672412872, 0.38541001081466...
by
[ -0.11575999855995178, -0.06088100001215935, -0.13401000201702118, -0.6143500208854675, -0.1975499987602234, 0.2341800034046173, -3.3754000663757324, -0.10871999710798264, 0.5164600014686584, -0.09328299760818481, -0.5612999796867371, -0.004758900031447411, -0.08771099895238876, -0.11326000...
are
[ -0.3214400112628937, 0.11529000103473663, 0.009374000132083893, -0.760129988193512, -0.02691500075161457, 0.23743000626564026, -4.3171000480651855, 0.026366999372839928, 0.27994000911712646, -0.517300009727478, 0.6854599714279175, 0.6759300231933594, 0.12276999652385712, -0.164299994707107...
at
[ 0.19857999682426453, -0.21295000612735748, 0.5813599824905396, 0.11703000217676163, -0.3590199947357178, -0.29798001050949097, -3.3127999305725098, -0.4083699882030487, 0.5484200119972229, 0.011262999847531319, -0.2766999900341034, 0.2171200066804886, -0.3662300109863281, 0.164470002055168...
as
[ 0.08373799920082092, 0.13401000201702118, -0.40647000074386597, -0.34961000084877014, 0.07624500244855881, -0.37206000089645386, -4.242800235748291, 0.5160599946975708, -0.10842999815940857, -0.4391799867153168, 0.32853999733924866, 0.03621400147676468, 0.22279000282287598, -0.115149997174...
be
[ -0.24443000555038452, 0.03334299847483635, 0.0628340020775795, -0.32583001255989075, 0.24149000644683838, 0.2626599967479706, -4.515699863433838, 0.7521200180053711, 0.2752799987792969, -0.4595800042152405, 0.44273999333381653, -0.3541400134563446, 0.1961199939250946, -0.28341999650001526,...
from
[ -0.36079999804496765, 0.2533699870109558, -0.15906000137329102, -0.6192600131034851, 0.3708299994468689, -0.44016000628471375, -3.658900022506714, -0.4485499858856201, -0.758400022983551, 0.15861999988555908, -0.01360199972987175, 0.00478440010920167, -0.3875400125980377, -0.14042000472545...
have
[ -0.17050999402999878, 0.08594000339508057, -0.007723900023847818, -0.2020300030708313, 0.056731000542640686, 0.06937400251626968, -4.359499931335449, 0.3347199857234955, 0.26019999384880066, -0.662850022315979, 0.20324000716209412, 0.3895699977874756, 0.07657299935817719, -0.03425300121307...
was
[ -0.0421999990940094, -0.0004441399942152202, 0.05289499834179878, -0.051688000559806824, 0.01348700001835823, -0.7998700141906738, -3.661600112915039, 0.47123000025749207, 0.014875000342726707, -0.5800399780273438, -0.050214000046253204, -0.2538500130176544, -0.22904999554157257, -0.568359...
or
[ 0.23332999646663666, -0.30333998799324036, -0.4449099898338318, -0.030650999397039413, 0.15669000148773193, 0.1630299985408783, -4.347400188446045, 0.7563499808311462, -0.20262999832630157, -0.3025600016117096, 0.9518300294876099, -0.4129300117492676, 0.06598799675703049, -0.27924999594688...
End of preview. Expand in Data Studio

GloVe Pre-trained Word Vectors

该仓库将 GloVe(Global Vectors for Word Representation)预训练词向量整理为 Hugging Face Dataset。每个配置对应一套官方发布语料,每个 split 名称表示词向量维度。

配置

Config 语料 Split / 维度 词表大小
6B Wikipedia 2014 + Gigaword 5 50d, 100d, 200d, 300d 400,000
42B Common Crawl 42B tokens 300d 1,917,494
840B Common Crawl 840B tokens 300d 2,196,017
twitter27B Twitter 27B tokens 25d, 50d, 100d, 200d 1,193,514

全部配置的下载大小合计约为 7.9 GB。只需加载所需配置和维度,无需下载其他向量。

字段说明

每行表示一个 token 及其词向量:

  • word:原始词表中的 token。
  • vector:对应的 float32 向量;长度由 split 名称决定。

例如,6B 配置的 100d split 中,每个 vector 包含 100 个浮点数。

加载数据

加载 6B 的全部维度:

from datasets import load_dataset


dataset = load_dataset("wliafe/glove", "6B")
print(dataset)
print(dataset["50d"][0])

只加载一个维度:

from datasets import load_dataset


vectors = load_dataset(
    "wliafe/glove",
    "twitter27B",
    split="100d",
)

print(vectors.features)
print(vectors[0]["word"])
print(len(vectors[0]["vector"]))

其他配置示例:

from datasets import load_dataset


glove_42b = load_dataset("wliafe/glove", "42B", split="300d")
glove_840b = load_dataset("wliafe/glove", "840B", split="300d")

查询词向量

Dataset.filter() 可以直接查找少量 token,但它会扫描整个 split:

from datasets import load_dataset


vectors = load_dataset("wliafe/glove", "6B", split="50d")
matches = vectors.filter(lambda row: row["word"] == "king")

if len(matches) == 0:
    raise KeyError("king 不在词表中")

king_vector = matches[0]["vector"]
print(len(king_vector))

频繁查询时,建议一次性建立 token 到行号或向量的索引,并根据内存容量选择所需配置。大型配置不适合无条件转换为完整的 Python 字典。

使用说明

  • token 的大小写、标点和分词形式沿用原始 GloVe 文件。
  • 不同配置的词表互不保证一致。
  • split 名称是向量维度,不是训练集或测试集划分。
  • 向量以 float32 保存。

引用

如果该数据集对你的研究有帮助,请引用 GloVe:

@inproceedings{pennington2014glove,
  title={GloVe: Global Vectors for Word Representation},
  author={Pennington, Jeffrey and Socher, Richard and Manning, Christopher D.},
  booktitle={Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
  pages={1532--1543},
  year={2014}
}

原始向量、语料说明和使用条款请以 GloVe 官方项目页面 为准。

Downloads last month
177