Code Monkey home page Code Monkey logo

Comments (2)

wbchief avatar wbchief commented on July 17, 2024

Hi, thank you for your great work!

I encountered the following error in predictor.py` when trying to test BertAbs model.

python train.py -task abs -mode test -test_from ../models/abs/model_step_8000.pt -batch_size 3000 -test_batch_size 500 -bert_data_path ../bert_data/bert.pt_data -log_file ../logs/test_abs -model_path ../models/abs -sep_optim true -use_interval true -visible_gpus 0 -max_pos 512 -max_length 200 -alpha 0.95 -min_length 50 -result_path ../logs/abs

Traceback (most recent call last):
File "train.py", line 135, in
test_abs(args, device_id, cp, step)
File "/home/t-kasanishi/PreSumm/src/train_abstractive.py", line 225, in test_abs
predictor.translate(test_iter, step)
File "/home/t-kasanishi/PreSumm/src/models/predictor.py", line 149, in translate
batch_data = self.translate_batch(batch)
File "/home/t-kasanishi/PreSumm/src/models/predictor.py", line 218, in translate_batch
min_length=self.min_length)
File "/home/t-kasanishi/PreSumm/src/models/predictor.py", line 333, in _fast_translate_batch
[alive_seq.index_select(0, select_indices),
RuntimeError: "index_select_out_cuda_impl" not implemented for 'Float'

Below is a shape and contents of select_indices and alive_seq. FloatTensor cannot be used for the argument of .index_select() (only IntTensor or LongTensor is suitable). How should I fix it? Thank you!

select_indices.shape: torch.Size([30])
select_indices: tensor([ 0.0654, 0.0655, 0.0657, 0.0340, 0.0674, 5.0654, 5.0655, 5.0657,
5.0340, 5.0674, 10.0654, 10.0657, 10.0655, 10.0340, 10.0657, 15.0654,
15.0655, 15.0657, 15.0340, 15.0674, 20.0654, 20.0655, 20.0657, 20.0340,
20.0657, 25.0654, 25.0655, 25.0657, 25.0340, 25.0674], device='cuda:0')
alive_seq.shape: torch.Size([30, 1])
alive_seq: tensor([[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1]], device='cuda:0')

topk_beam_index = topk_ids.div(vocab_size)

        topk_beam_index = topk_ids // vocab_size

from presumm.

Dengguty avatar Dengguty commented on July 17, 2024

请问解决了吗?我也遇到了这个问题

from presumm.

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.