emonty777 commited on
Commit
219d72f
1 Parent(s): 430d119

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -0
README.md CHANGED
@@ -59,6 +59,25 @@ tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
59
  model = PeftModel.from_pretrained(model, peft_model_id, device_map={"":0})
60
  model.eval()
61
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  ## Training procedure
64
 
 
59
  model = PeftModel.from_pretrained(model, peft_model_id, device_map={"":0})
60
  model.eval()
61
  ```
62
+ 2. Generating summaries
63
+
64
+ ```python
65
+ text = "Your text goes here..."
66
+
67
+ # If you want to use CPU
68
+ input_ids = tokenizer(text, return_tensors="pt", truncation=True).input_ids
69
+ # Ir you want to use GPU
70
+ input_ids = tokenizer(text, return_tensors="pt", truncation=True).input_ids.cuda()
71
+ # Adjust max_new_tokens based on size. This is set up for articles of text
72
+ outputs = model.generate(input_ids=input_ids, max_new_tokens=120, do_sample=False)
73
+
74
+ print(f"input sentence: {sample['article']}\n{'---'* 20}")
75
+ print(f"summary:\n{tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True)[0]}")
76
+
77
+
78
+
79
+ ```
80
+
81
 
82
  ## Training procedure
83