Rajan18 commited on
Commit
66d7e9f
·
verified ·
1 Parent(s): 7d6e855

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +2 -2
utils.py CHANGED
@@ -14,7 +14,7 @@ def generate_story(prompt, duration):
14
  text = tokenizer(
15
  f"Write a detailed story of {duration} minutes about: {prompt}",
16
  return_tensors="pt"
17
- ).to("cuda")
18
 
19
  output = model.generate(**text, max_new_tokens=900)
20
  story = tokenizer.decode(output[0], skip_special_tokens=True)
@@ -37,7 +37,7 @@ def generate_images(story):
37
  sd = StableDiffusionPipeline.from_pretrained(
38
  "runwayml/stable-diffusion-v1-5",
39
  torch_dtype=torch.float16
40
- ).to("cuda")
41
 
42
  scenes = story.split(".")[:10] # create 10 images max
43
  paths = []
 
14
  text = tokenizer(
15
  f"Write a detailed story of {duration} minutes about: {prompt}",
16
  return_tensors="pt"
17
+ ).to("cpu")
18
 
19
  output = model.generate(**text, max_new_tokens=900)
20
  story = tokenizer.decode(output[0], skip_special_tokens=True)
 
37
  sd = StableDiffusionPipeline.from_pretrained(
38
  "runwayml/stable-diffusion-v1-5",
39
  torch_dtype=torch.float16
40
+ ).to("cpu")
41
 
42
  scenes = story.split(".")[:10] # create 10 images max
43
  paths = []