CoolFace
Datasetpublic

model-metadata/code_python_files

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes13kdownloads
amd_Nitro-E_0.py68 linesDownload Raw Back to root
1# /// script2# requires-python = ">=3.12"3# dependencies = [4#     "numpy",5#     "einops",6#     "pandas",7#     "matplotlib",8#     "paddleorc",9#     "protobuf",10#     "torch",11#     "sentencepiece",12#     "torchvision",13#     "transformers",14#     "timm",15#     "diffusers",16#     "sentence-transformers",17#     "accelerate",18#     "peft",19#     "slack-sdk",20# ]21# ///22 23try:24    import torch25    from diffusers import DiffusionPipeline26    27    # switch to "mps" for apple devices28    pipe = DiffusionPipeline.from_pretrained("amd/Nitro-E", dtype=torch.bfloat16, device_map="cuda")29    30    prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"31    image = pipe(prompt).images[0]32    with open('amd_Nitro-E_0.txt', 'w', encoding='utf-8') as f:33        f.write('Everything was good in amd_Nitro-E_0.txt')34except Exception as e:35    import os36    from slack_sdk import WebClient37    client = WebClient(token=os.environ['SLACK_TOKEN'])38    client.chat_postMessage(39        channel='#hub-model-metadata-snippets-sprint',40        text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/amd_Nitro-E_0.txt|amd_Nitro-E_0.txt>',41    )42 43    with open('amd_Nitro-E_0.txt', 'a', encoding='utf-8') as f:44        import traceback45        f.write('''```CODE: 46import torch47from diffusers import DiffusionPipeline48 49# switch to "mps" for apple devices50pipe = DiffusionPipeline.from_pretrained("amd/Nitro-E", dtype=torch.bfloat16, device_map="cuda")51 52prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"53image = pipe(prompt).images[0]54```55 56ERROR: 57''')58        traceback.print_exc(file=f)59    60finally:61    from huggingface_hub import upload_file62    upload_file(63        path_or_fileobj='amd_Nitro-E_0.txt',64        repo_id='model-metadata/code_execution_files',65        path_in_repo='amd_Nitro-E_0.txt',66        repo_type='dataset',67    )68