Browse Source

cancel restriction for base model

tags/v0.1.0
FengZiYjun 7 years ago
parent
commit
4c9c791304
1 changed files with 1 additions and 20 deletions
  1. +1
    -20
      fastNLP/models/base_model.py

+ 1
- 20
fastNLP/models/base_model.py View File

@@ -3,31 +3,12 @@ import torch

class BaseModel(torch.nn.Module):
"""Base PyTorch model for all models.
Three network modules presented:
- encoder module
- aggregation module
- decoder module
Subclasses must implement these three modules with "components".
To do: add some useful common features
"""

def __init__(self):
super(BaseModel, self).__init__()

def forward(self, *inputs):
x = self.encode(*inputs)
x = self.aggregate(x)
x = self.decode(x)
return x

def encode(self, x):
raise NotImplementedError

def aggregate(self, x):
raise NotImplementedError

def decode(self, x):
raise NotImplementedError


class Vocabulary(object):
"""A look-up table that allows you to access `Lexeme` objects. The `Vocab`


Loading…
Cancel
Save