rk404 commited on
Commit
3df0acb
1 Parent(s): bc59449

Fix import and typo in device

Browse files

- pipeline wasn't imported so it was giving error.
- It should be "cpu" instead of "CPU" in ``device=torch.device("cuda" if torch.cuda.is_available() else "CPU"),``

Files changed (1) hide show
  1. README.md +2 -2
README.md CHANGED
@@ -59,7 +59,7 @@ Additionally, `distilroberta-base` is case-sensitive model.
59
  ### Transformers
60
 
61
  ```python
62
- from transformers import AutoTokenizer, AutoModelForSequenceClassification
63
  import torch
64
 
65
  tokenizer = AutoTokenizer.from_pretrained("ProtectAI/distilroberta-base-rejection-v1")
@@ -71,7 +71,7 @@ classifier = pipeline(
71
  tokenizer=tokenizer,
72
  truncation=True,
73
  max_length=512,
74
- device=torch.device("cuda" if torch.cuda.is_available() else "CPU"),
75
  )
76
 
77
  print(classifier("Sorry, but I can't assist with that."))
 
59
  ### Transformers
60
 
61
  ```python
62
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
63
  import torch
64
 
65
  tokenizer = AutoTokenizer.from_pretrained("ProtectAI/distilroberta-base-rejection-v1")
 
71
  tokenizer=tokenizer,
72
  truncation=True,
73
  max_length=512,
74
+ device=torch.device("cuda" if torch.cuda.is_available() else "cpu"),
75
  )
76
 
77
  print(classifier("Sorry, but I can't assist with that."))