Code Monkey home page Code Monkey logo

Comments (3)

namisan avatar namisan commented on June 2, 2024

If you have e.g., 3 task A, B, C during the training, the task id for A, B, C is 0, 1, 2 respectively which is used to select the correct task header.

from mt-dnn.

hoangthangta avatar hoangthangta commented on June 2, 2024

I use this command:

python3 predict.py --task homicide --task_def dataset/all_task_def.yml --max_seq_len 128 --batch_size_eval 8 --checkpoint checkpoint/model_2.pt --prep_input dataset/bert-base-multilingual-cased/test.json --with_label --task_id 1 --score dataset/bert-base-multilingual-cased/test_pred.json

and here is an error:

Traceback (most recent call last):
  File "predict.py", line 108, in <module>
    with_label=args.with_label,
  File "/home/thang/mt-dnn/mt_dnn/inference.py", line 97, in eval_model
    score, pred, gold = model.predict(batch_info, batch_data)
  File "/home/thang/mt-dnn/mt_dnn/model.py", line 421, in predict
    score = self.mnetwork(*inputs)
  File "/home/thang/.env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/thang/.env/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 166, in forward
    return self.module(*inputs[0], **kwargs[0])
  File "/home/thang/.env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/thang/mt-dnn/mt_dnn/matcher.py", line 204, in forward
    decoder_opt = self.decoder_opt[task_id]
IndexError: list index out of range

Hope you can help to figure out how to fix.

from mt-dnn.

hoangthangta avatar hoangthangta commented on June 2, 2024

In the predict.py, I have to modify this:

task_def_list = [task_def]*5 # 5 is the number of tasks, here all 5 tasks are binary classification
or define your one here, or by arguments if you want.
task_def_list = [task_def, task_def, task_def, task_def, task_def]

It seems predict.py needed to rewrite a bit more to support multi head predictions.

from mt-dnn.

Related Issues (20)

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.