Code Monkey home page Code Monkey logo

msgi / nlp-journey Goto Github PK

View Code? Open in Web Editor NEW
1.6K 62.0 379.0 9.98 MB

Documents, papers and codes related to Natural Language Processing, including Topic Model, Word Embedding, Named Entity Recognition, Text Classificatin, Text Generation, Text Similarity, Machine Translation),etc. All codes are implemented intensorflow 2.0.

Home Page: https://github.com/msgi/nlp-journey

License: Apache License 2.0

Python 100.00%
ner embedding classification similarity keras tensorflow lda gensim fasttext svm

nlp-journey's Introduction

nlp journey

Star Fork GitHub Issues License

All implemented in tensorflow 2.0,codes

1. Basics

2. Books

  1. Handbook of Graphical Models. online
  2. Deep Learning. online
  3. Neural Networks and Deep Learning. online
  4. Speech and Language Processing. online

3. Papers

01) Transformer papers

  1. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. paper
  2. GPT-2: Language Models are Unsupervised Multitask Learners. paper
  3. Transformer-XL: Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context. paper
  4. XLNet: Generalized Autoregressive Pretraining for Language Understanding. paper
  5. RoBERTa: Robustly Optimized BERT Pretraining Approach. paper
  6. DistilBERT: a distilled version of BERT: smaller, faster, cheaper and lighter. paper
  7. ALBERT: A Lite BERT for Self-supervised Learning of Language Representations. paper
  8. T5: Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. paper
  9. ELECTRA: pre-training text encoders as discriminators rather than generators. paper
  10. GPT3: Language Models are Few-Shot Learners. paper

02) Models

  1. LSTM(Long Short-term Memory). paper
  2. Sequence to Sequence Learning with Neural Networks. paper
  3. Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation. paper
  4. Residual Network(Deep Residual Learning for Image Recognition). paper
  5. Dropout(Improving neural networks by preventing co-adaptation of feature detectors). paper
  6. Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift. paper

03) Summaries

  1. An overview of gradient descent optimization algorithms. paper
  2. Analysis Methods in Neural Language Processing: A Survey. paper
  3. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. paper
  4. A Review on Generative Adversarial Networks: Algorithms, Theory, and Applications. paper
  5. A Gentle Introduction to Deep Learning for Graphs. paper
  6. A Survey on Deep Learning for Named Entity Recognition. paper
  7. More Data, More Relations, More Context and More Openness: A Review and Outlook for Relation Extraction. paper
  8. Deep Learning Based Text Classification: A Comprehensive Review. paper
  9. Pre-trained Models for Natural Language Processing: A Survey. paper
  10. A Survey on Contextual Embeddings. paper
  11. A Survey on Knowledge Graphs: Representation, Acquisition and Applications. paper
  12. Knowledge Graphs. paper
  13. Pre-trained Models for Natural Language Processing: A Survey. paper

04) Pre-training

  1. A Neural Probabilistic Language Model. paper
  2. word2vec Parameter Learning Explained. paper
  3. Language Models are Unsupervised Multitask Learners. paper
  4. An Empirical Study of Smoothing Techniques for Language Modeling. paper
  5. Efficient Estimation of Word Representations in Vector Space. paper
  6. Distributed Representations of Sentences and Documents. paper
  7. Enriching Word Vectors with Subword Information(FastText). paper
  8. GloVe: Global Vectors for Word Representation. online
  9. ELMo (Deep contextualized word representations). paper
  10. Pre-Training with Whole Word Masking for Chinese BERT. paper

05) Classification

  1. Bag of Tricks for Efficient Text Classification (FastText). paper
  2. Convolutional Neural Networks for Sentence Classification. paper
  3. Attention-Based Bidirectional Long Short-Term Memory Networks for Relation Classification. paper

06) Text generation

  1. A Deep Ensemble Model with Slot Alignment for Sequence-to-Sequence Natural Language Generation. paper
  2. SeqGAN: Sequence Generative Adversarial Nets with Policy Gradient. paper

07) Text Similarity

  1. Learning to Rank Short Text Pairs with Convolutional Deep Neural Networks. paper
  2. Learning Text Similarity with Siamese Recurrent Networks. paper
  3. A Deep Architecture for Matching Short Texts. paper

08) QA

  1. A Question-Focused Multi-Factor Attention Network for Question Answering. paper
  2. The Design and Implementation of XiaoIce, an Empathetic Social Chatbot. paper
  3. A Knowledge-Grounded Neural Conversation Model. paper
  4. Neural Generative Question Answering. paper
  5. Sequential Matching Network A New Architecture for Multi-turn Response Selection in Retrieval-Based Chatbots.paper
  6. Modeling Multi-turn Conversation with Deep Utterance Aggregation.paper
  7. Multi-Turn Response Selection for Chatbots with Deep Attention Matching Network.paper
  8. Deep Reinforcement Learning For Modeling Chit-Chat Dialog With Discrete Attributes. paper

09) NMT

  1. Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation. paper
  2. Neural Machine Translation by Jointly Learning to Align and Translate. paper
  3. Transformer (Attention Is All You Need). paper

10) Summary

  1. Get To The Point: Summarization with Pointer-Generator Networks. paper
  2. Deep Recurrent Generative Decoder for Abstractive Text Summarization. paper

11) Relation extraction

  1. Distant Supervision for Relation Extraction via Piecewise Convolutional Neural Networks. paper
  2. Neural Relation Extraction with Multi-lingual Attention. paper
  3. FewRel: A Large-Scale Supervised Few-Shot Relation Classification Dataset with State-of-the-Art Evaluation. paper
  4. End-to-End Relation Extraction using LSTMs on Sequences and Tree Structures. paper

12) Large Language Models

  1. Training language models to follow instructions with human feedback. paper
  2. LLaMA: Open and Efficient Foundation Language Models. paper

4. Articles

  • 如何学习自然语言处理(综合版). url
  • TRANSFORMERS FROM SCRATCH. url
  • The Illustrated Transformer.url
  • Attention-based-model. url
  • Modern Deep Learning Techniques Applied to Natural Language Processing. url
  • 难以置信!LSTM和GRU的解析从未如此清晰(动图+视频)。url
  • 从语言模型到Seq2Seq:Transformer如戏,全靠Mask. url
  • Applying word2vec to Recommenders and Advertising. url
  • 2019 NLP大全:论文、博客、教程、工程进展全梳理. url

5. Github

6. Blog

nlp-journey's People

Contributors

msgi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nlp-journey's Issues

tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0,77] = -1 is not in [0, 49) [Op:GatherV2]

tf.Tensor(
[[ 57 327 630 ... 0 0 0]
[ 850 1979 2299 ... 0 0 0]
[ 474 814 91 ... 0 0 0]
...
[ 44 110 881 ... 0 0 0]
[ 0 33 825 ... 0 0 0]
[1787 1895 119 ... 0 0 0]], shape=(64, 100), dtype=int32)
tf.Tensor(
[[ 0 0 0 ... -1 -1 -1]
[ 1 2 2 ... -1 -1 -1]
[ 0 0 0 ... -1 -1 -1]
...
[ 0 0 3 ... -1 -1 -1]
[ 0 0 0 ... -1 -1 -1]
[ 3 4 0 ... -1 -1 -1]], shape=(64, 100), dtype=int32)
Traceback (most recent call last):
File "c:\Users\Administrator\Desktop\keras_ner\ner.py", line 213, in
file_path='data')
File "c:\Users\Administrator\Desktop\keras_ner\ner.py", line 77, in init
self.model = self.train()
File "c:\Users\Administrator\Desktop\keras_ner\ner.py", line 103, in train
loss, logits, text_lens = self.train_one_step(model, optimizer, text_batch, labels_batch)
File "c:\Users\Administrator\Desktop\keras_ner\ner.py", line 117, in train_one_step
logits, text_lens, log_likelihood = model(text_batch, labels_batch, training=True)
File "D:\anaconda3\lib\site-packages\tensorflow_core\python\keras\engine\base_layer.py", line 822, in call
outputs = self.call(cast_inputs, *args, **kwargs)
File "c:\Users\Administrator\Desktop\keras_ner\ner.py", line 41, in call
log_likelihood, self.transition_params = ta.text.crf_log_likelihood(logits, label_sequences, text_lens)
File "D:\anaconda3\lib\site-packages\tensorflow_addons\text\crf.py", line 214, in crf_log_likelihood
inputs, tag_indices, sequence_lengths, transition_params
File "D:\anaconda3\lib\site-packages\tensorflow_addons\text\crf.py", line 77, in crf_sequence_score
return tf.cond(tf.equal(tf.shape(inputs)[1], 1), _single_seq_fn, _multi_seq_fn)
File "D:\anaconda3\lib\site-packages\tensorflow_core\python\ops\control_flow_ops.py", line 1389, in cond_for_tf_v2
return cond(pred, true_fn=true_fn, false_fn=false_fn, strict=True, name=name)
File "D:\anaconda3\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "D:\anaconda3\lib\site-packages\tensorflow_core\python\ops\control_flow_ops.py", line 1204, in cond
result = false_fn()
File "D:\anaconda3\lib\site-packages\tensorflow_addons\text\crf.py", line 72, in _multi_seq_fn
tag_indices, sequence_lengths, transition_params
File "D:\anaconda3\lib\site-packages\tensorflow_addons\text\crf.py", line 291, in crf_binary_score
binary_scores = tf.gather(flattened_transition_params, flattened_transition_indices)
File "D:\anaconda3\lib\site-packages\tensorflow_core\python\util\dispatch.py", line 180, in wrapper
return target(*args, **kwargs)
File "D:\anaconda3\lib\site-packages\tensorflow_core\python\ops\array_ops.py", line 4125, in gather_v2
batch_dims=batch_dims)
File "D:\anaconda3\lib\site-packages\tensorflow_core\python\util\dispatch.py", line 180, in wrapper
return target(*args, **kwargs)
File "D:\anaconda3\lib\site-packages\tensorflow_core\python\ops\array_ops.py", line 4108, in gather
return gen_array_ops.gather_v2(params, indices, axis, name=name)
File "D:\anaconda3\lib\site-packages\tensorflow_core\python\ops\gen_array_ops.py", line 3683, in gather_v2
_ops.raise_from_not_ok_status(e, name)
File "D:\anaconda3\lib\site-packages\tensorflow_core\python\framework\ops.py", line 6606, in raise_from_not_ok_status
six.raise_from(core._status_to_exception(e.code, message), None)
File "", line 3, in raise_from
tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0,77] = -1 is not in [0, 49) [Op:GatherV2]

大神,这是数据集问题吗?

Undefined names in pre_process.py

flake8 testing of https://github.com/msgi/nlp-journey on Python 3.7.1

$ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

./nlp/utils/pre_process.py:7:56: F821 undefined name 'stop_words'
    sentences = [' '.join([l for l in line if l not in stop_words]) for line in lines]
                                                       ^
./nlp/utils/pre_process.py:7:81: F821 undefined name 'lines'
    sentences = [' '.join([l for l in line if l not in stop_words]) for line in lines]
                                                                                ^
./nlp/utils/pre_process.py:10:22: F821 undefined name 'lines'
        o.writelines(lines)
                     ^
3     F821 undefined name 'stop_words'
3

E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. These 5 are different from most other flake8 issues which are merely "style violations" -- useful for readability but they do not effect runtime safety.

  • F821: undefined name name
  • F822: undefined name name in __all__
  • F823: local variable name referenced before assignment
  • E901: SyntaxError or IndentationError
  • E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree

keras_contrib报错

2020-04-24 11:14:12.760618: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-04-24 11:14:12.760859: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Using TensorFlow backend.
2020-04-24 11:14:17.101006: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-04-24 11:14:17.535028: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1555] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1050 computeCapability: 6.1
coreClock: 1.493GHz coreCount: 5 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 104.43GiB/s
2020-04-24 11:14:17.537454: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-04-24 11:14:17.539765: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cublas64_10.dll'; dlerror: cublas64_10.dll not found
2020-04-24 11:14:17.541926: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cufft64_10.dll'; dlerror: cufft64_10.dll not found
2020-04-24 11:14:17.544355: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'curand64_10.dll'; dlerror: curand64_10.dll not found
2020-04-24 11:14:17.547207: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found
2020-04-24 11:14:17.549591: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusparse64_10.dll'; dlerror: cusparse64_10.dll not found
2020-04-24 11:14:17.554696: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2020-04-24 11:14:17.554892: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1592] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2020-04-24 11:14:17.555937: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-04-24 11:14:17.556583: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1096] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-04-24 11:14:17.556732: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102]
Traceback (most recent call last):
File "c:\Users\Administrator\Desktop\keras_ner\ner.py", line 163, in
ner = BiLSTMCRFNamedEntityRecognition('model/crf.h5', 'model/config.pkl', train=True, file_path='data/')
File "c:\Users\Administrator\Desktop\keras_ner\ner.py", line 73, in init
self.model = self.train()
File "c:\Users\Administrator\Desktop\keras_ner\ner.py", line 77, in train
model = self.__build_model()
File "c:\Users\Administrator\Desktop\keras_ner\ner.py", line 134, in __build_model
model.add(crf)
File "D:\anaconda3\envs\tensorflow\lib\site-packages\tensorflow_core\python\training\tracking\base.py", line 457, in _method_wrapper
result = method(self, *args, **kwargs)
File "D:\anaconda3\envs\tensorflow\lib\site-packages\tensorflow_core\python\keras\engine\sequential.py", line 161, in add
'Found: ' + str(layer))
TypeError: The added layer must be an instance of class Layer. Found: <keras_contrib.layers.crf.CRF object at 0x0000018943E28A58>

Keras 2.3.1
keras-contrib 2.0.8
tensorflow 2.1.0

你好,你的版本是这些吗

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.