Use this

  
      gist.github.com
  
  
    https://gist.github.com/Tushar-N/dfca335e370a2bc3bc79876e6270099e 148
pad_packed_demo.py
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence

seqs = ['gigantic_string','tiny_str','medium_str']

# make <pad> idx 0
vocab = ['<pad>'] + sorted(set(''.join(seqs)))

# make model
This file has been truncated. show original