GithubHelp home page GithubHelp logo

weinyn / dietclassifier-pytorch Goto Github PK

View Code? Open in Web Editor NEW
44.0 44.0 14.0 93 KB

DIET Classifier mini implementation on pytorch.

Python 100.00%
dual-intent-entity entity-recognition huggingface-transformers intent-classification nlp nlu transformers-library

dietclassifier-pytorch'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

Watchers

 avatar  avatar

dietclassifier-pytorch's Issues

how to evaluate a new dataset

How to evaluate a new domain question dataset? During training process, datasets was split into training and evaluating parts. And I want to only evaluate a new testing datasets using a well-trained model. How to do that?

I have tried methods below:
using wrapper predict function to get intent and entity predict results, and get metrics. But I have to predict results using my own batch scripts, it's really time-consuming.

Is there any good ways to evaluting a new dataset?

Loading the local model will report an error

Traceback (most recent call last):
  File "D:/pycharm/DIETClassifier-pytorch-main/main.py", line 5, in <module>
    from demo.server import app
  File "D:\pycharm\DIETClassifier-pytorch-main\demo\server.py", line 15, in <module>
    wrapper = DIETClassifierWrapper(CONFIG_FILE)
  File "D:\pycharm\DIETClassifier-pytorch-main\src\models\wrapper.py", line 62, in __init__
    self.model = DIETClassifier(config=self.model_config)
  File "D:\pycharm\DIETClassifier-pytorch-main\src\models\classifier.py", line 57, in __init__
    self.entities_list = ["O"] + config.entities
AttributeError: 'PretrainedConfig' object has no attribute 'entities'

AttributeError: 'NoneType' object has no attribute 'detach' metric_for_best_model change "loss" to "f1"

企业微信截图_16337656213244

computer_metrics

tensors is None
the type of tensors is <class 'NoneType'>
Traceback (most recent call last):
File "train.py", line 65, in
trainer.train()
File "/data1/Semantic_team/chatbot/DIET/DIETClassifier-pytorch/src/models/trainer.py", line 77, in train
self.trainer.train()
File "/data1/anaconda3/envs/diet_py36/lib/python3.6/site-packages/transformers/trainer.py", line 935, in train
self._maybe_log_save_evaluate(tr_loss, model, trial, epoch)
File "/data1/anaconda3/envs/diet_py36/lib/python3.6/site-packages/transformers/trainer.py", line 1004, in _maybe_log_save_evaluate
metrics = self.evaluate()
File "/data1/anaconda3/envs/diet_py36/lib/python3.6/site-packages/transformers/trainer.py", line 1449, in evaluate
metric_key_prefix=metric_key_prefix,
File "/data1/anaconda3/envs/diet_py36/lib/python3.6/site-packages/transformers/trainer.py", line 1566, in prediction_loop
loss, logits, labels = self.prediction_step(model, inputs, prediction_loss_only, ignore_keys=ignore_keys)
File "/data1/anaconda3/envs/diet_py36/lib/python3.6/site-packages/transformers/trainer.py", line 1695, in prediction_step
logits = nested_detach(logits)
File "/data1/anaconda3/envs/diet_py36/lib/python3.6/site-packages/transformers/trainer_pt_utils.py", line 106, in nested_detach
return type(tensors)(nested_detach(t) for t in tensors)
File "/data1/anaconda3/envs/diet_py36/lib/python3.6/site-packages/transformers/trainer_pt_utils.py", line 106, in
return type(tensors)(nested_detach(t) for t in tensors)
File "/data1/anaconda3/envs/diet_py36/lib/python3.6/site-packages/transformers/trainer_pt_utils.py", line 107, in nested_detach
return tensors.detach()
AttributeError: 'NoneType' object has no attribute 'detach'

CUDA error: device-side assert triggered

When I added some new intents and entities in nlu.yml and ran wrapper.py triggering train_model(). this arises with error below.

/pytorch/aten/src/THCUNN/ClassNLLCriterion.cu:108: cunn_ClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [0,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/ClassNLLCriterion.cu:108: cunn_ClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [1,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/ClassNLLCriterion.cu:108: cunn_ClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [2,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/ClassNLLCriterion.cu:108: cunn_ClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [3,0,0] Assertion t >= 0 && t < n_classes failed.
Traceback (most recent call last):
File "src/classification/wrapper.py", line 243, in
wrapper.train_model()
File "src/classification/wrapper.py", line 227, in train_model
trainer.train()
File "/mnt/e/intellemo/official/chat-nlp-aiapi/src/classification/trainer.py", line 52, in train
self.trainer.train()
File "/mnt/e/intellemo/official/chat-nlp-aiapi/algosrc/lib/python3.8/site-packages/transformers/trainer.py", line 1280, in train
tr_loss += self.training_step(model, inputs)
File "/mnt/e/intellemo/official/chat-nlp-aiapi/algosrc/lib/python3.8/site-packages/transformers/trainer.py", line 1773, in training_step
loss = self.compute_loss(model, inputs)
File "/mnt/e/intellemo/official/chat-nlp-aiapi/algosrc/lib/python3.8/site-packages/transformers/trainer.py", line 1805, in compute_loss
outputs = model(**inputs)
File "/mnt/e/intellemo/official/chat-nlp-aiapi/algosrc/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/mnt/e/intellemo/official/chat-nlp-aiapi/src/classification/classifier.py", line 143, in forward
entities_loss = entities_loss_fct(active_logits, active_labels)
File "/mnt/e/intellemo/official/chat-nlp-aiapi/algosrc/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/mnt/e/intellemo/official/chat-nlp-aiapi/algosrc/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 1120, in forward
return F.cross_entropy(input, target, weight=self.weight,
File "/mnt/e/intellemo/official/chat-nlp-aiapi/algosrc/lib/python3.8/site-packages/torch/nn/functional.py", line 2824, in cross_entropy
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
RuntimeError: CUDA error: device-side assert triggered
0%| | 2/22600 [00:01<4:19:44, 1.45it/s]

Is that something that i need to increase the number of labels?

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.