Skip to content
Permalink
Browse files

Don't deprecate bidirectional-language-model name (#2297)

  • Loading branch information...
nelson-liu authored and matt-gardner committed Jan 7, 2019
1 parent 01913fb commit b0191969fcd007803f87c48d7288d8480cebcb02
Showing with 3 additions and 10 deletions.
  1. +2 −5 allennlp/common/registrable.py
  2. +1 −5 allennlp/models/bidirectional_lm.py
@@ -4,9 +4,8 @@
for registering them.
"""
from collections import defaultdict
from typing import TypeVar, Type, Dict, List, Optional
from typing import TypeVar, Type, Dict, List
import logging
import warnings

from allennlp.common.checks import ConfigurationError
from allennlp.common.from_params import FromParams
@@ -40,9 +39,7 @@ class Registrable(FromParams):
default_implementation: str = None

@classmethod
def register(cls: Type[T], name: str, deprecation_message: Optional[str] = None):
if deprecation_message is not None:
warnings.warn(deprecation_message, DeprecationWarning)
def register(cls: Type[T], name: str):
registry = Registrable._registry[cls]
def add_subclass_to_registry(subclass: Type[T]):
# Add to registry, raise an error if key has already been used.
@@ -45,11 +45,7 @@ def forward(self, embeddings: torch.Tensor, targets: torch.Tensor) -> torch.Tens
return torch.nn.functional.nll_loss(probs, targets.long(), reduction="sum")


@Model.register('bidirectional-language-model',
deprecation_message=('The "bidirectional-language-model" name was '
'deprecated in version 0.8 and will be removed'
'in version 0.10 . '
'Use "bidirectional_language_model" instead.'))
@Model.register('bidirectional-language-model')
@Model.register('bidirectional_language_model')
class BidirectionalLanguageModel(Model):
"""

0 comments on commit b019196

Please sign in to comment.
You can’t perform that action at this time.