Py之torchtext:torchtext库的简介、安装、使用方法之详细攻略

Py之torchtext:torchtext库的简介、安装、使用方法之详细攻略

目录

torchtext库的简介

torchtext库的安装

torchtext库的使用方法

1、基础案例


torchtext库的简介

      torchtext库是PyTorch项目的一部分。PyTorch 是一个开源机器学习框架。该torchtext软件包由数据处理实用程序和流行的自然语言数据集组成。

官方API文档torchtext — Torchtext 0.15.0 documentation

torchtext库的安装

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple torchtext

pip install torchtext==0.10.0
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple torchtext==0.10.0


torchtext库的使用方法

1、基础案例

from torchtext.data import Field
tokenize = lambda x:x.split()
TEXT = Field(sequential = True, tokenize = tokenize, lower = True)

LABEL = Field(sequential = False, use_vocab = False)

猜你喜欢

转载自blog.csdn.net/qq_41185868/article/details/129722644