CoolFace
Datasetpublic

model-metadata/code_python_files

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes14kdownloads
meituan-longcat_LongCat-Video_0.py67 linesDownload Raw Back to root
1# /// script2# requires-python = ">=3.12"3# dependencies = [4#     "numpy",5#     "einops",6#     "pandas",7#     "matplotlib",8#     "protobuf",9#     "torch",10#     "sentencepiece",11#     "torchvision",12#     "transformers",13#     "timm",14#     "diffusers",15#     "sentence-transformers",16#     "accelerate",17#     "peft",18#     "slack-sdk",19# ]20# ///21 22try:23    import torch24    from diffusers import DiffusionPipeline25    26    # switch to "mps" for apple devices27    pipe = DiffusionPipeline.from_pretrained("meituan-longcat/LongCat-Video", dtype=torch.bfloat16, device_map="cuda")28    29    prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"30    image = pipe(prompt).images[0]31    with open('meituan-longcat_LongCat-Video_0.txt', 'w', encoding='utf-8') as f:32        f.write('Everything was good in meituan-longcat_LongCat-Video_0.txt')33except Exception as e:34    import os35    from slack_sdk import WebClient36    client = WebClient(token=os.environ['SLACK_TOKEN'])37    client.chat_postMessage(38        channel='#hub-model-metadata-snippets-sprint',39        text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/meituan-longcat_LongCat-Video_0.txt|meituan-longcat_LongCat-Video_0.txt>',40    )41 42    with open('meituan-longcat_LongCat-Video_0.txt', 'a', encoding='utf-8') as f:43        import traceback44        f.write('''```CODE: 45import torch46from diffusers import DiffusionPipeline47 48# switch to "mps" for apple devices49pipe = DiffusionPipeline.from_pretrained("meituan-longcat/LongCat-Video", dtype=torch.bfloat16, device_map="cuda")50 51prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"52image = pipe(prompt).images[0]53```54 55ERROR: 56''')57        traceback.print_exc(file=f)58    59finally:60    from huggingface_hub import upload_file61    upload_file(62        path_or_fileobj='meituan-longcat_LongCat-Video_0.txt',63        repo_id='model-metadata/code_execution_files',64        path_in_repo='meituan-longcat_LongCat-Video_0.txt',65        repo_type='dataset',66    )67