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 # Login into Hugging Face Hub17 from huggingface_hub import login18 login()19 with open('google_embeddinggemma-300m_1.txt', 'w', encoding='utf-8') as f:20 f.write('Everything was good in google_embeddinggemma-300m_1.txt')21except Exception as e:22 import os23 from slack_sdk import WebClient24 client = WebClient(token=os.environ['SLACK_TOKEN'])25 client.chat_postMessage(26 channel='#hub-model-metadata-snippets-sprint',27 text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/google_embeddinggemma-300m_1.txt|google_embeddinggemma-300m_1.txt>',28 )29 30 with open('google_embeddinggemma-300m_1.txt', 'a', encoding='utf-8') as f:31 import traceback32 f.write('''```CODE: 33# Login into Hugging Face Hub34from huggingface_hub import login35login()36```37 38ERROR: 39''')40 traceback.print_exc(file=f)41 42finally:43 from huggingface_hub import upload_file44 upload_file(45 path_or_fileobj='google_embeddinggemma-300m_1.txt',46 repo_id='model-metadata/code_execution_files',47 path_in_repo='google_embeddinggemma-300m_1.txt',48 repo_type='dataset',49 )50 