CoolFace
Datasetpublic

model-metadata/code_python_files

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes15kdownloads
nineninesix_kani-tts-400m-en_1.py59 linesDownload Raw Back to root
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    # Load model directly22    from transformers import AutoTokenizer, AutoModelForCausalLM23    24    tokenizer = AutoTokenizer.from_pretrained("nineninesix/kani-tts-400m-en")25    model = AutoModelForCausalLM.from_pretrained("nineninesix/kani-tts-400m-en")26    with open('nineninesix_kani-tts-400m-en_1.txt', 'w', encoding='utf-8') as f:27        f.write('Everything was good in nineninesix_kani-tts-400m-en_1.txt')28except Exception as e:29    import os30    from slack_sdk import WebClient31    client = WebClient(token=os.environ['SLACK_TOKEN'])32    client.chat_postMessage(33        channel='#hub-model-metadata-snippets-sprint',34        text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/nineninesix_kani-tts-400m-en_1.txt|nineninesix_kani-tts-400m-en_1.txt>',35    )36 37    with open('nineninesix_kani-tts-400m-en_1.txt', 'a', encoding='utf-8') as f:38        import traceback39        f.write('''```CODE: 40# Load model directly41from transformers import AutoTokenizer, AutoModelForCausalLM42 43tokenizer = AutoTokenizer.from_pretrained("nineninesix/kani-tts-400m-en")44model = AutoModelForCausalLM.from_pretrained("nineninesix/kani-tts-400m-en")45```46 47ERROR: 48''')49        traceback.print_exc(file=f)50    51finally:52    from huggingface_hub import upload_file53    upload_file(54        path_or_fileobj='nineninesix_kani-tts-400m-en_1.txt',55        repo_id='model-metadata/code_execution_files',56        path_in_repo='nineninesix_kani-tts-400m-en_1.txt',57        repo_type='dataset',58    )59