model-metadata/code_python_files
013k
1# /// script2# requires-python = ">=3.12"3# dependencies = [4# "torch",5# "torchvision",6# "transformers",7# "diffusers",8# "sentence-transformers",9# "accelerate",10# "peft",11# "slack-sdk",12# ]13# ///14 15try:16 from diffusers import DiffusionPipeline17 18 pipe = DiffusionPipeline.from_pretrained("lightx2v/Wan2.2-Distill-Models")19 20 prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"21 image = pipe(prompt).images[0]22 with open('lightx2v_Wan2.2-Distill-Models_0.txt', 'w', encoding='utf-8') as f:23 f.write('Everything was good in lightx2v_Wan2.2-Distill-Models_0.txt')24except Exception as e:25 import os26 from slack_sdk import WebClient27 client = WebClient(token=os.environ['SLACK_TOKEN'])28 client.chat_postMessage(29 channel='#exp-slack-alerts',30 text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/lightx2v_Wan2.2-Distill-Models_0.txt|lightx2v_Wan2.2-Distill-Models_0.txt>',31 )32 33 with open('lightx2v_Wan2.2-Distill-Models_0.txt', 'a', encoding='utf-8') as f:34 import traceback35 f.write('''```CODE: 36from diffusers import DiffusionPipeline37 38pipe = DiffusionPipeline.from_pretrained("lightx2v/Wan2.2-Distill-Models")39 40prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"41image = pipe(prompt).images[0]42```43 44ERROR: 45''')46 traceback.print_exc(file=f)47 48finally:49 from huggingface_hub import upload_file50 upload_file(51 path_or_fileobj='lightx2v_Wan2.2-Distill-Models_0.txt',52 repo_id='model-metadata/code_execution_files',53 path_in_repo='lightx2v_Wan2.2-Distill-Models_0.txt',54 repo_type='dataset',55 )56 