Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for TF 2.0 #60

Open
SivamPillai opened this issue Oct 15, 2019 · 6 comments
Open

Support for TF 2.0 #60

SivamPillai opened this issue Oct 15, 2019 · 6 comments

Comments

@SivamPillai
Copy link

Hi,

Are there any plan to upgrade the library to support TF 2.0? I feel some of the new features can help simplify the code library and may also improve performance.

Thanks,
Sivam.

@Romaixn
Copy link

Romaixn commented Feb 10, 2021

+1 That would be cool! And the library could work like this, for the moment tf.contrib doesn't exist

@xavierad
Copy link

xavierad commented Oct 6, 2021

I solved it by using:

    # vocab_words = tf.contrib.lookup.index_table_from_file(
    #     params['words'], num_oov_buckets=params['num_oov_buckets'])
    num_oov_buckets = params['num_oov_buckets']
    vocab_words = tf.lookup.StaticVocabularyTable(
        tf.lookup.TextFileInitializer(
            params['words'],
            key_dtype=tf.string, key_index=tf.lookup.TextFileIndex.WHOLE_LINE,
            value_dtype=tf.int64, value_index=tf.lookup.TextFileIndex.LINE_NUMBER,
            delimiter="\t"),
        num_oov_buckets)

    # vocab_chars = tf.contrib.lookup.index_table_from_file(
    #     params['chars'], num_oov_buckets=params['num_oov_buckets'])
    vocab_chars = tf.lookup.StaticVocabularyTable(
        tf.lookup.TextFileInitializer(
            params['chars'],
            key_dtype=tf.string, key_index=tf.lookup.TextFileIndex.WHOLE_LINE,
            value_dtype=tf.int64, value_index=tf.lookup.TextFileIndex.LINE_NUMBER,
            delimiter="\t"),
        num_oov_buckets)

@JamesPiggott
Copy link

Dear xavierad, I cannot imagine that that is the only alteration you made. I get error messages that LSTMBlockFusedCell is no longer supported with TF 2.0 which is confirmed online.

@xavierad
Copy link

Yes. I just copied the class code to local. Tensorflow sucks

@JamesPiggott
Copy link

Interesting, could you push those changes to your fork?

@iprovalo
Copy link

Here is my fork with TF2 implementation of one of the models:

https://github.com/iprovalo/tf_ner/tree/master/models/chars_conv_lstm_crf_tf2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants