Repository: tensorflow/addons

Issue:
Move CRFWrapper to tfa.text with crf module
# Description

Brief Description of the PR:
Per discussion in the monthly meeting... I don't think we yet have a compelling case for making tfa.models a new subpackage with Addons.

Previous PR was https://github.com/tensorflow/addons/pull/2555

## Type of change

- [ ] Bug fix
- [ ] New Tutorial
- [ ] Updated or additional documentation
- [ ] Additional Testing
- [ ] New Activation and the changes conform to the [activation contribution guidelines](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/activations/README.md#contribution-guidelines)
- [ ] New Callback and the changes conform to the [callback contribution guidelines](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/callbacks/README.md#contribution-guidelines)
- [ ] New Image addition and the changes conform to the [image op contribution guidelines](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/image/README.md#contribution-guidelines)
- [ ] New Layer and the changes conform to the [layer contribution guidelines](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/layers/README.md#contribution-guidelines)
- [ ] New Loss and the changes conform to the [loss contribution guidelines](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/losses/README.md#contribution-guidelines)
- [ ] New Metric and the changes conform to the [metric contribution guidelines](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/metrics/README.md#contribution-guidelines)
- [ ] New Optimizer and the changes conform to the [optimizer contribution guidelines](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/optimizers/README.md#contribution-guidelines)
- [ ] New RNN Cell and the changes conform to the [rnn contribution guidelines](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/rnn/README.md#contribution-guidelines)
- [ ] New Seq2seq addition and the changes conform to the [seq2seq contribution guidelines](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/seq2seq/README.md#contribution-guidelines)
- [ ] New Text addition and the changes conform to the [text op contribution guidelines](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/text/README.md#contribution-guidelines)

# Checklist:

- [x] I've properly [formatted my code according to the guidelines](https://github.com/tensorflow/addons/blob/master/CONTRIBUTING.md#coding-style)
    - [ ] By running Black + Flake8
    - [x] By running pre-commit hooks
- [ ] This PR addresses an already submitted issue for TensorFlow Addons
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] This PR contains modifications to C++ custom-ops

# How Has This Been Tested?

If you're adding a bugfix or new feature please describe the tests that you ran to verify your changes:
*  



Discussion:

Resolving patch:
diff --git a/tensorflow_addons/models/__init__.py b/tensorflow_addons/models/__init__.py
deleted file mode 100644
diff --git a/tensorflow_addons/text/__init__.py b/tensorflow_addons/text/__init__.py
--- a/tensorflow_addons/text/__init__.py
+++ b/tensorflow_addons/text/__init__.py
@@ -30,6 +30,7 @@
 from tensorflow_addons.text.crf import crf_sequence_score
 from tensorflow_addons.text.crf import crf_unary_score
 from tensorflow_addons.text.crf import viterbi_decode
+from tensorflow_addons.text.crf_wrapper import CRFModelWrapper
 from tensorflow_addons.text.parse_time_op import parse_time
 
 # Skip Gram Sampling
diff --git a/tensorflow_addons/models/crf_wrapper.py b/tensorflow_addons/text/crf_wrapper.py
similarity index 89%
rename from tensorflow_addons/models/crf_wrapper.py
rename to tensorflow_addons/text/crf_wrapper.py
--- a/tensorflow_addons/models/crf_wrapper.py
+++ b/tensorflow_addons/text/crf_wrapper.py
@@ -1,6 +1,7 @@
 import tensorflow as tf
-from tensorflow_addons import layers
-from tensorflow_addons import text
+
+from tensorflow_addons.text import crf_log_likelihood
+from tensorflow_addons.utils import types
 
 
 @tf.keras.utils.register_keras_serializable(package="Addons")
@@ -9,15 +10,19 @@ def __init__(
         self,
         base_model: tf.keras.Model,
         units: int,
-        chain_initializer="orthogonal",
+        chain_initializer: types.Initializer = "orthogonal",
         use_boundary: bool = True,
-        boundary_initializer="zeros",
+        boundary_initializer: types.Initializer = "zeros",
         use_kernel: bool = True,
         **kwargs,
     ):
         super().__init__()
 
-        self.crf_layer = layers.CRF(
+        # lazy import to solve circle import issue:
+        # tfa.layers.CRF -> tfa.text.__init__ -> tfa.text.crf_wrapper -> tfa.layers.CRF
+        from tensorflow_addons.layers.crf import CRF  # noqa
+
+        self.crf_layer = CRF(
             units=units,
             chain_initializer=chain_initializer,
             use_boundary=use_boundary,
@@ -66,9 +71,7 @@ def call(self, inputs, training=None, mask=None, return_crf_internal=False):
     def compute_crf_loss(
         self, potentials, sequence_length, kernel, y, sample_weight=None
     ):
-        crf_likelihood, _ = text.crf_log_likelihood(
-            potentials, y, sequence_length, kernel
-        )
+        crf_likelihood, _ = crf_log_likelihood(potentials, y, sequence_length, kernel)
         # convert likelihood to loss
         flat_crf_loss = -1 * crf_likelihood
         if sample_weight is not None:


Test patch:
diff --git a/tensorflow_addons/models/tests/crf_wrapper_test.py b/tensorflow_addons/text/tests/crf_wrapper_test.py
similarity index 97%
rename from tensorflow_addons/models/tests/crf_wrapper_test.py
rename to tensorflow_addons/text/tests/crf_wrapper_test.py
--- a/tensorflow_addons/models/tests/crf_wrapper_test.py
+++ b/tensorflow_addons/text/tests/crf_wrapper_test.py
@@ -20,7 +20,7 @@
 import numpy as np
 import pytest
 import tensorflow as tf
-from tensorflow_addons.models.crf_wrapper import CRFModelWrapper
+from tensorflow_addons.text.crf_wrapper import CRFModelWrapper
 
 
 def get_test_data():