pengdaqian commited on
Commit
f0c5f90
·
1 Parent(s): f737e6e
audio_text_embeddings.safetensors → audio_text_embeddings_cpu.safetensors RENAMED
File without changes
main.py CHANGED
@@ -94,7 +94,7 @@ global auto_pipeline, text2img_pipeline, s3_client
94
 
95
  if __name__ == "__main__":
96
  auto_pipeline = AudioPipeline(audio_text_path='/home/user/app/dedup_audio_text_80.json',
97
- audio_text_embeddings_path='/home/user/app/audio_text_embeddings.safetensors')
98
  text2img_pipeline = init_text2img_pipe()
99
  s3_client = Minio(
100
  os.environ.get("S3_ENDPOINT"),
 
94
 
95
  if __name__ == "__main__":
96
  auto_pipeline = AudioPipeline(audio_text_path='/home/user/app/dedup_audio_text_80.json',
97
+ audio_text_embeddings_path='/home/user/app/audio_text_embeddings_cpu.safetensors')
98
  text2img_pipeline = init_text2img_pipe()
99
  s3_client = Minio(
100
  os.environ.get("S3_ENDPOINT"),
test.py CHANGED
@@ -1,7 +1,15 @@
1
- from optimum.onnxruntime import ORTStableDiffusionPipeline
 
2
 
3
- model_id = "eatdianatoday/yiwu"
4
- pipe = ORTStableDiffusionPipeline.from_pretrained(model_id, export=True)
5
- prompt = "a photo of an astronaut riding a horse on mars"
6
- images = pipe(prompt).images[0]
7
- pipe.save_pretrained("/root/autodl-tmp/onnx-novelai-diffusion")
 
 
 
 
 
 
 
 
1
+ from safetensors import safe_open
2
+ from safetensors.torch import save_file
3
 
4
+ tensors = {}
5
+
6
+ with safe_open('audio_text_embeddings.safetensors', framework="pt", device=0) as f:
7
+ for k in f.keys():
8
+ tensors[k] = f.get_tensor(k)
9
+
10
+ text_embed = tensors["text_embed"].detach().cpu()
11
+
12
+ tensors = {
13
+ "text_embed": text_embed,
14
+ }
15
+ save_file(tensors, "/root/autodl-tmp/audio_text_embeddings_ cpu.safetensors")
warm_up.py CHANGED
@@ -11,7 +11,7 @@ if __name__ == "__main__":
11
  "(bad proportions:1.331)",
12
  ]
13
  pipeline = AudioPipeline(audio_text_path='/home/user/app/dedup_audio_text_80.json',
14
- audio_text_embeddings_path='/home/user/app/audio_text_embeddings.safetensors')
15
  text = pipeline.audio2txt('/home/user/app/demo.wav')
16
 
17
  text2img_pipeline = init_text2img_pipe()
 
11
  "(bad proportions:1.331)",
12
  ]
13
  pipeline = AudioPipeline(audio_text_path='/home/user/app/dedup_audio_text_80.json',
14
+ audio_text_embeddings_path='/home/user/app/audio_text_embeddings_cpu.safetensors')
15
  text = pipeline.audio2txt('/home/user/app/demo.wav')
16
 
17
  text2img_pipeline = init_text2img_pipe()