22.02.2024 Views

Daniel Voigt Godoy - Deep Learning with PyTorch Step-by-Step A Beginner’s Guide-leanpub

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

import torch

import torch.optim as optim

import torch.nn as nn

import torch.nn.functional as F

from torch.utils.data import DataLoader, Dataset, random_split, \

TensorDataset

from data_generation.nlp import ALICE_URL, WIZARD_URL, download_text

from stepbystep.v4 import StepByStep

# These are the classes we built in Chapters 9 and 10

from seq2seq import *

import nltk

from nltk.tokenize import sent_tokenize

import gensim

from gensim import corpora, downloader

from gensim.parsing.preprocessing import *

from gensim.utils import simple_preprocess

from gensim.models import Word2Vec

from flair.data import Sentence

from flair.embeddings import ELMoEmbeddings, WordEmbeddings, \

TransformerWordEmbeddings, TransformerDocumentEmbeddings

from datasets import load_dataset, Split

from transformers import (

DataCollatorForLanguageModeling,

BertModel, BertTokenizer, BertForSequenceClassification,

DistilBertModel, DistilBertTokenizer,

DistilBertForSequenceClassification,

AutoModelForSequenceClassification,

AutoModel, AutoTokenizer, AutoModelForCausalLM,

Trainer, TrainingArguments, pipeline, TextClassificationPipeline

)

from transformers.pipelines import SUPPORTED_TASKS

882 | Chapter 11: Down the Yellow Brick Rabbit Hole

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!