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 # Use a pipeline as a high-level helper17 from transformers import pipeline18 19 pipe = pipeline("text-generation", model="utter-project/EuroLLM-1.7B")20 with open('utter-project_EuroLLM-1.7B_0.txt', 'w', encoding='utf-8') as f:21 f.write('Everything was good in utter-project_EuroLLM-1.7B_0.txt')22except Exception as e:23 import os24 from slack_sdk import WebClient25 client = WebClient(token=os.environ['SLACK_TOKEN'])26 client.chat_postMessage(27 channel='#exp-slack-alerts',28 text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/utter-project_EuroLLM-1.7B_0.txt|utter-project_EuroLLM-1.7B_0.txt>',29 )30 31 with open('utter-project_EuroLLM-1.7B_0.txt', 'a', encoding='utf-8') as f:32 import traceback33 f.write('''```CODE: 34# Use a pipeline as a high-level helper35from transformers import pipeline36 37pipe = pipeline("text-generation", model="utter-project/EuroLLM-1.7B")38```39 40ERROR: 41''')42 traceback.print_exc(file=f)43 44finally:45 from huggingface_hub import upload_file46 upload_file(47 path_or_fileobj='utter-project_EuroLLM-1.7B_0.txt',48 repo_id='model-metadata/code_execution_files',49 path_in_repo='utter-project_EuroLLM-1.7B_0.txt',50 repo_type='dataset',51 )52 