devanshamin
commited on
Commit
•
486a7e9
1
Parent(s):
feef0a1
Update README.md
Browse files
README.md
CHANGED
@@ -57,7 +57,7 @@ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float32
|
|
57 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
58 |
|
59 |
def inference(prompt: str) -> str:
|
60 |
-
model_inputs = tokenizer([prompt], return_tensors="pt").to(
|
61 |
generated_ids = model.generate(model_inputs.input_ids, max_new_tokens=512)
|
62 |
generated_ids = [output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)]
|
63 |
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
|
|
57 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
58 |
|
59 |
def inference(prompt: str) -> str:
|
60 |
+
model_inputs = tokenizer([prompt], return_tensors="pt").to('cuda')
|
61 |
generated_ids = model.generate(model_inputs.input_ids, max_new_tokens=512)
|
62 |
generated_ids = [output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)]
|
63 |
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|