model-metadata/code_python_files
015k
1# /// script2# requires-python = ">=3.12"3# dependencies = [4# "numpy",5# "einops",6# "pandas",7# "protobuf",8# "torch",9# "torchvision",10# "transformers",11# "timm",12# "diffusers",13# "sentence-transformers",14# "accelerate",15# "peft",16# "slack-sdk",17# ]18# ///19 20try:21 # Use a pipeline as a high-level helper22 from transformers import pipeline23 24 pipe = pipeline("text-to-speech", model="nineninesix/kani-tts-400m-en")25 with open('nineninesix_kani-tts-400m-en_0.txt', 'w', encoding='utf-8') as f:26 f.write('Everything was good in nineninesix_kani-tts-400m-en_0.txt')27except Exception as e:28 import os29 from slack_sdk import WebClient30 client = WebClient(token=os.environ['SLACK_TOKEN'])31 client.chat_postMessage(32 channel='#hub-model-metadata-snippets-sprint',33 text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/nineninesix_kani-tts-400m-en_0.txt|nineninesix_kani-tts-400m-en_0.txt>',34 )35 36 with open('nineninesix_kani-tts-400m-en_0.txt', 'a', encoding='utf-8') as f:37 import traceback38 f.write('''```CODE: 39# Use a pipeline as a high-level helper40from transformers import pipeline41 42pipe = pipeline("text-to-speech", model="nineninesix/kani-tts-400m-en")43```44 45ERROR: 46''')47 traceback.print_exc(file=f)48 49finally:50 from huggingface_hub import upload_file51 upload_file(52 path_or_fileobj='nineninesix_kani-tts-400m-en_0.txt',53 repo_id='model-metadata/code_execution_files',54 path_in_repo='nineninesix_kani-tts-400m-en_0.txt',55 repo_type='dataset',56 )57 