Update README.md
Browse files
README.md
CHANGED
@@ -23,5 +23,20 @@ base_model:
|
|
23 |
- Trained over 3 epochs with learning rate adjustments and evaluation every 500 steps.
|
24 |
|
25 |
## Usage
|
|
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
To use this model for text generation:
|
|
|
23 |
- Trained over 3 epochs with learning rate adjustments and evaluation every 500 steps.
|
24 |
|
25 |
## Usage
|
26 |
+
import torch
|
27 |
|
28 |
+
# Check if a GPU is available
|
29 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
30 |
+
|
31 |
+
# Move the model to the device
|
32 |
+
model.to(device)
|
33 |
+
input_text = "tell me joke with bbc"
|
34 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
35 |
+
input_ids = input_ids.to(device)
|
36 |
+
|
37 |
+
# Generate summary
|
38 |
+
output = model.generate(input_ids, max_length=50, num_beams=4, early_stopping=True)
|
39 |
+
generated_summary = tokenizer.decode(output[0], skip_special_tokens=True)
|
40 |
+
|
41 |
+
print(generated_summary)
|
42 |
To use this model for text generation:
|