Code Monkey home page Code Monkey logo

text_classification's Introduction

  • 👋 Hi, I’m LiZhen
  • 🔭 I’m currently working on meituan, focusing on enhancing user experience by leveraging the generative capabilities of large models.
  • 🌱 I’m currently learning Spring Cloud to deepen my expertise in microservices architecture.
  • 👯 I’m looking to collaborate on open-source projects or innovative tech initiatives that push the boundaries of current tech.
  • 📫 How to reach me: You can find me via email at email: [email protected].
  • 😄 Pronouns: He/Him
  • ⚡ Fun fact: In my free time, I enjoy watching movies, reading novels, and keeping up with the latest technology trends.

activity graph

text_classification's People

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

text_classification's Issues

python版本

请问python版本是多少,我用python3.6安装requirements.txt中的包,发现很多包都装不了,不知道是不是版本的问题

训练HAN模型报错

请问大佬测试过HAN模型吗?我训练的时候会报RuntimeError: CUDA error: device-side assert triggered,请问是什么原因呢?
请帮忙解答,非常感谢!

error log:
0it [00:00, ?it/s]Building prefix dict from the default dictionary ...
hierattnet
Building prefix dict from the default dictionary ...
Loading model from cache /tmp/jieba.cache
Loading model from cache /tmp/jieba.cache
Loading model cost 2.178 seconds.
Loading model cost 2.178 seconds.
Prefix dict has been built successfully.
Prefix dict has been built successfully.
50000it [06:22, 130.57it/s]
5000it [00:37, 132.38it/s]
10000it [01:20, 123.86it/s]HierAttNet(
(word_att_net): WordAttNet(
(dropout): Dropout(p=0.5, inplace=False)
(embedding): Embedding(144241, 300)
(rnn): GRU(300, 64, num_layers=2, batch_first=True, dropout=0.5, bidirectional=True)
)
(sent_att_net): SentAttNet(
(rnn): GRU(128, 64, num_layers=2, batch_first=True, dropout=0.5, bidirectional=True)
(fc): Linear(in_features=128, out_features=10, bias=True)
)
)
Trainable parameters: 398602
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [16,0,0], thread: [0,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [16,0,0], thread: [1,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [16,0,0], thread: [2,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [16,0,0], thread: [3,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [16,0,0], thread: [4,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [16,0,0], thread: [5,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [16,0,0], thread: [6,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [16,0,0], thread: [7,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [16,0,0], thread: [8,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block:
……
……
……
[14,0,0], thread: [78,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [79,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [80,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [81,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [82,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [83,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [84,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [85,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [86,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [87,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [88,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [89,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [90,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [91,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [92,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [93,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [94,0,0] Assertion srcIndex < srcSelectDimSize failed.
/opt/conda/conda-bld/pytorch_1595629416375/work/aten/src/THC/THCTensorIndex.cu:272: indexSelectLargeIndex: block: [14,0,0], thread: [95,0,0] Assertion srcIndex < srcSelectDimSize failed.

Traceback (most recent call last):
File "train.py", line 134, in
run('configs/multi_classification/han_config.json')
File "train.py", line 105, in run
main(config, use_transformers=False)
File "train.py", line 80, in main
trainer.train()
File "/home/work/zzk/text_classification/base/base_trainer.py", line 67, in train
result = self._train_epoch(epoch)
File "/home/work/zzk/text_classification/trainer/trainer.py", line 52, in _train_epoch
output = self.model(input_token_ids,bert_masks, seq_lens).squeeze(1)
File "/home/work/anaconda3/envs/zzk_torch_py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/work/zzk/text_classification/model/model.py", line 404, in forward
word_output, hidden = self.word_att_net(input_token_ids,seq_lens)
File "/home/work/anaconda3/envs/zzk_torch_py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/work/zzk/text_classification/model/model.py", line 473, in forward
packed_embedded = nn.utils.rnn.pack_padded_sequence(embedded, sorted_seq_lengths, batch_first=self.batch_first)
File "/home/work/anaconda3/envs/zzk_torch_py36/lib/python3.6/site-packages/torch/nn/utils/rnn.py", line 234, in pack_padded_sequence
lengths = torch.as_tensor(lengths, dtype=torch.int64)
RuntimeError: CUDA error: device-side assert triggered

AttributeError: 'NoneType' object has no attribute 'add_graph'

in file weibo_trainer.py

line 116, in _valid_epoch
self.writer.writer.add_graph(input_model,[input_ids,mask_attentions, text_lengths])
AttributeError: 'NoneType' object has no attribute 'add_graph'

code output is as follows:


loading features from cache file : htqe_data/.cache/htqe_train.cache...
loading features from cache file : htqe_data/.cache/htqe_valid.cache...
TextCNN1d(
(embedding): Embedding(17707, 300)
(convs): ModuleList(
(0): Conv1d(300, 100, kernel_size=(3,), stride=(1,))
(1): Conv1d(300, 100, kernel_size=(5,), stride=(1,))
(2): Conv1d(300, 100, kernel_size=(7,), stride=(1,))
)
(fc): Linear(in_features=300, out_features=2, bias=True)
(dropout): Dropout(p=0.5, inplace=False)
)
Trainable parameters: 450902
Train Epoch: 1 [0/47 (0%)] Loss: 0.699
Train Epoch: 1 [10/47 (21%)] Loss: 0.637
Train Epoch: 1 [20/47 (43%)] Loss: 0.684
Train Epoch: 1 [30/47 (64%)] Loss: 0.626
Train Epoch: 1 [40/47 (85%)] Loss: 0.680
Traceback (most recent call last):
File "/home/david/Workspace/text_classification/train.py", line 65, in
run('configs/binary_classification/word_embedding_text_cnn_1d.yml')
File "/home/david/Workspace/text_classification/train.py", line 60, in run
main(config)
File "/home/david/Workspace/text_classification/train.py", line 51, in main
trainer.train()
File "/home/david/Workspace/text_classification/base/base_trainer.py", line 82, in train
result = self._train_epoch(epoch)
File "/home/david/Workspace/text_classification/trainer/htqe_trainer.py", line 82, in _train_epoch
val_log = self._valid_epoch(epoch)
File "/home/david/Workspace/text_classification/trainer/htqe_trainer.py", line 116, in _valid_epoch
self.writer.writer.add_graph(input_model,[input_ids,text_lengths])
AttributeError: 'NoneType' object has no attribute 'add_graph'
[Finished in 7.2s]

请问“微博情感分类“数据用的哪一份?

data目录下只有停用词,没找到训练数据

  "dataset": {
    "type": "WeiboDataSet",
    "args": {
      "data_dir": "data/weibo",
      "data_name": "weibo_senti_100k.csv",
      "word_embedding_path": "data/word_embedding/sgns.sogou.char"
    }

缺少json文件

configs/multi_classification/下面缺少了inference.py文件要用的json文件,可以发出来参考一下嘛

KeyError: '[SEP]'

对HAN模型进行训练时,出现报错信息:File "/home1/mayifan/demo/text_classification/model/model.py", line 385, in
sep_index = [i for i, num in enumerate(doc_list) if num == self.word_embedding.stoi['[SEP]']]
KeyError: '[SEP]'

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.