pszemraj commited on
Commit
94ac8b3
1 Parent(s): 16ef34e

Add device to example

Browse files
Files changed (1) hide show
  1. README.md +7 -17
README.md CHANGED
@@ -263,32 +263,22 @@ model-index:
263
  - this param forces the model to use new vocabulary and create an abstractive summary, otherwise it may compile the best _extractive_ summary from the input provided.
264
  - create the pipeline object:
265
 
266
- ```
267
- from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
268
  from transformers import pipeline
269
 
270
  hf_name = 'pszemraj/led-large-book-summary'
271
 
272
- _model = AutoModelForSeq2SeqLM.from_pretrained(
273
- hf_name,
274
- low_cpu_mem_usage=True,
275
- )
276
-
277
- _tokenizer = AutoTokenizer.from_pretrained(
278
- hf_name
279
- )
280
-
281
-
282
  summarizer = pipeline(
283
- "summarization",
284
- model=_model,
285
- tokenizer=_tokenizer
286
- )
287
  ```
288
 
289
  - put words into the pipeline object:
290
 
291
- ```
292
  wall_of_text = "your words here"
293
 
294
  result = summarizer(
 
263
  - this param forces the model to use new vocabulary and create an abstractive summary, otherwise it may compile the best _extractive_ summary from the input provided.
264
  - create the pipeline object:
265
 
266
+ ```python
267
+ import torch
268
  from transformers import pipeline
269
 
270
  hf_name = 'pszemraj/led-large-book-summary'
271
 
 
 
 
 
 
 
 
 
 
 
272
  summarizer = pipeline(
273
+ "summarization",
274
+ hf_name,
275
+ device=0 if torch.cuda.is_available() else -1,
276
+ )
277
  ```
278
 
279
  - put words into the pipeline object:
280
 
281
+ ```python
282
  wall_of_text = "your words here"
283
 
284
  result = summarizer(