model-metadata/code_python_files
013k
1# /// script2# requires-python = ">=3.12"3# dependencies = [4# "numpy",5# "einops",6# "pandas",7# "protobuf",8# "torch",9# "sentencepiece",10# "torchvision",11# "transformers",12# "timm",13# "diffusers",14# "sentence-transformers",15# "accelerate",16# "peft",17# "slack-sdk",18# ]19# ///20 21try:22 # Use a pipeline as a high-level helper23 from transformers import pipeline24 25 pipe = pipeline("text-generation", model="ByteDance/Ouro-1.4B", trust_remote_code=True)26 messages = [27 {"role": "user", "content": "Who are you?"},28 ]29 pipe(messages)30 with open('ByteDance_Ouro-1.4B_0.txt', 'w', encoding='utf-8') as f:31 f.write('Everything was good in ByteDance_Ouro-1.4B_0.txt')32except Exception as e:33 import os34 from slack_sdk import WebClient35 client = WebClient(token=os.environ['SLACK_TOKEN'])36 client.chat_postMessage(37 channel='#hub-model-metadata-snippets-sprint',38 text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/ByteDance_Ouro-1.4B_0.txt|ByteDance_Ouro-1.4B_0.txt>',39 )40 41 with open('ByteDance_Ouro-1.4B_0.txt', 'a', encoding='utf-8') as f:42 import traceback43 f.write('''```CODE: 44# Use a pipeline as a high-level helper45from transformers import pipeline46 47pipe = pipeline("text-generation", model="ByteDance/Ouro-1.4B", trust_remote_code=True)48messages = [49 {"role": "user", "content": "Who are you?"},50]51pipe(messages)52```53 54ERROR: 55''')56 traceback.print_exc(file=f)57 58finally:59 from huggingface_hub import upload_file60 upload_file(61 path_or_fileobj='ByteDance_Ouro-1.4B_0.txt',62 repo_id='model-metadata/code_execution_files',63 path_in_repo='ByteDance_Ouro-1.4B_0.txt',64 repo_type='dataset',65 )66 