stanford-futuredata / ColBERT

ColBERT: state-of-the-art neural search (SIGIR'20, TACL'21, NeurIPS'21, NAACL'22, CIKM'22, ACL'23, EMNLP'23)
MIT License
2.95k stars 377 forks source link

How to use a designated GPU for training? #265

Open shishijier opened 11 months ago

shishijier commented 11 months ago

I have 8 GPUs and I want to use one of them for training, but I haven't found the relevant settings.

from colbert.infra import Run, RunConfig, ColBERTConfig
from colbert import Trainer

if __name__=='__main__':

    with Run().context(RunConfig(nranks=1, experiment="msmarco")):

        config = ColBERTConfig(
            bsize=16,
            root="/path/to/experiments",
        )
        trainer = Trainer(
            triples="triples.tsv",
            queries="queries.tsv",
            collection="collectios.tsv",
            config=config,
        )

        checkpoint_path = trainer.train()

        print(f"Saved checkpoint to {checkpoint_path}...")
Hannibal046 commented 9 months ago

maybe setting CUDA_VISIBLE_DEVICES=x?

adrienB134 commented 8 months ago

I think that if you set nranks to 8 you should be able to use your 8 GPUS.