ner_model = pipeline('ner', model=model, tokenizer=tokenizer, device=0, grouped_entities=True)
the device indicated pipeline to use no_gpu=0(only using GPU), please show me how to use multi-gpu.
ner_model = pipeline('ner', model=model, tokenizer=tokenizer, device=0, grouped_entities=True)
the device indicated pipeline to use no_gpu=0(only using GPU), please show me how to use multi-gpu.
Copyright © 2021 Jogjafile Inc.
There is an argument called
device_mapfor the pipelines in thetransformerslib; see here. It comes from theacceleratemodule; see here. You can specify a custom model dispatch, but you can also have it inferred automatically withdevice_map=" auto". Eventually, you might need additional configuration for the tokenizer, but it should look like this: