First of all install update and upgrade your system:
$ sudo apt update
$ sudo apt upgrade
Then, install required libraries:
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# vim: tabstop=4 shiftwidth=4 expandtab number | |
""" | |
glove的简易实现,包括 | |
- 准备训练数据 | |
- 训练词向量 | |
- 实验词向量观察语义空间的降维效果 |
# encoding=utf-8 | |
# Project: learn-pytorch | |
# Author: xingjunjie github: @gavinxing | |
# Create Time: 29/07/2017 11:58 AM on PyCharm | |
# Basic template from http://pytorch.org/tutorials/beginner/nlp/word_embeddings_tutorial.html | |
import torch | |
import torch.nn as nn | |
import torch.autograd as autograd | |
import torch.optim as optim |