Added device selection to transformers pipeline request to utilize GPU for inference

This commit is contained in:
KoboldAI Dev 2021-05-02 23:34:33 -04:00
parent 8dc97ba766
commit 97ad42efe6

View File

@ -108,7 +108,7 @@ if(vars.model != "InferKit"):
print("{0}Initializing transformers, please wait...{1}".format(colors.HEADER, colors.ENDC))
from transformers import pipeline, GPT2Tokenizer
generator = pipeline('text-generation', model=vars.model)
generator = pipeline('text-generation', model=vars.model, device=0)
tokenizer = GPT2Tokenizer.from_pretrained(vars.model)
print("{0}OK! {1} pipeline created!{2}".format(colors.OKGREEN, vars.model, colors.ENDC))
else: