How to run on GPU?

#6
by Wizd - opened

I found it runs on CPU by default.

I found it runs on CPU by default.

model = AutoModelForSequenceClassification.from_pretrained(
            pretrained_model_name_or_path=model_path,
            trust_remote_code=True,
        )
        
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.eval().to(device)

Sign up or log in to comment