GithubHelp home page GithubHelp logo

Comments (4)

MXueguang avatar MXueguang commented on July 17, 2024

Hi @WenzhengZhang,
In the paper, we use

a learning rate of 5e-6 with batch size 64 for 3 epochs

The batch size 64 here is 8 queries each batch x 8 documents each query.
i.e. the 8x8 setting in the github repo.

The following command should be able to reproduce the results (on 4x GPU):

If you want to train on single GPU, remove -m torch.distributed.launch --nproc_per_node=4 and negatives_x_device, and change per_device_train_batch_size to 8

python -m torch.distributed.launch --nproc_per_node=4 -m tevatron.driver.train \
  --output_dir ./retriever_model \
  --do_train \
  --model_name_or_path bert-base-uncased \
  --model_name_or_path bert-base-uncased \
  --dataset_name Tevatron/msmarco-passage \
  --save_steps 20000 \
  --q_max_len 16 \
  --p_max_len 128 \
  --fp16 \
  --per_device_train_batch_size 2 \
  --train_n_passages 8 \
  --learning_rate 5e-6 \
  --num_train_epochs 3 \
  --dataloader_num_workers 4 \
  --negatives_x_device

from tevatron.

WenzhengZhang avatar WenzhengZhang commented on July 17, 2024

Hi @WenzhengZhang, In the paper, we use

a learning rate of 5e-6 with batch size 64 for 3 epochs

The batch size 64 here is 8 queries each batch x 8 documents each query. i.e. the 8x8 setting in the github repo.

The following command should be able to reproduce the results (on 4x GPU):

If you want to train on single GPU, remove -m torch.distributed.launch --nproc_per_node=4 and negatives_x_device, and change per_device_train_batch_size to 8

python -m torch.distributed.launch --nproc_per_node=4 -m tevatron.driver.train \
  --output_dir ./retriever_model \
  --do_train \
  --model_name_or_path bert-base-uncased \
  --model_name_or_path bert-base-uncased \
  --dataset_name Tevatron/msmarco-passage \
  --save_steps 20000 \
  --q_max_len 16 \
  --p_max_len 128 \
  --fp16 \
  --per_device_train_batch_size 2 \
  --train_n_passages 8 \
  --learning_rate 5e-6 \
  --num_train_epochs 3 \
  --dataloader_num_workers 4 \
  --negatives_x_device

Hi @MXueguang ,
Thanks for your reply! Have you ever tried to set train_n_passages to be 2 for marco? Will only using one BM25 hard negative perform much worse than 7 BM25 hard negatives?

from tevatron.

MXueguang avatar MXueguang commented on July 17, 2024

Hi @WenzhengZhang,
If using train_n_passages=2, it may require a larger batch size to get the level of MRR. (e,g, batch size=128)

from tevatron.

WenzhengZhang avatar WenzhengZhang commented on July 17, 2024

Thanks a lot!

from tevatron.

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.