CoolFace
Datasetpublic

model-metadata/code_python_files

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes14kdownloads
allenai_Bolmo-1B_0.py59 linesDownload Raw Back to root
1# /// script2# requires-python = ">=3.12"3# dependencies = [4#     "numpy",5#     "einops",6#     "pandas",7#     "matplotlib",8#     "protobuf",9#     "torch",10#     "sentencepiece",11#     "torchvision",12#     "transformers",13#     "timm",14#     "diffusers",15#     "sentence-transformers",16#     "accelerate",17#     "peft",18#     "slack-sdk",19# ]20# ///21 22try:23    # Use a pipeline as a high-level helper24    from transformers import pipeline25    26    pipe = pipeline("text-generation", model="allenai/Bolmo-1B", trust_remote_code=True)27    with open('allenai_Bolmo-1B_0.txt', 'w', encoding='utf-8') as f:28        f.write('Everything was good in allenai_Bolmo-1B_0.txt')29except Exception as e:30    import os31    from slack_sdk import WebClient32    client = WebClient(token=os.environ['SLACK_TOKEN'])33    client.chat_postMessage(34        channel='#hub-model-metadata-snippets-sprint',35        text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/allenai_Bolmo-1B_0.txt|allenai_Bolmo-1B_0.txt>',36    )37 38    with open('allenai_Bolmo-1B_0.txt', 'a', encoding='utf-8') as f:39        import traceback40        f.write('''```CODE: 41# Use a pipeline as a high-level helper42from transformers import pipeline43 44pipe = pipeline("text-generation", model="allenai/Bolmo-1B", trust_remote_code=True)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='allenai_Bolmo-1B_0.txt',55        repo_id='model-metadata/code_execution_files',56        path_in_repo='allenai_Bolmo-1B_0.txt',57        repo_type='dataset',58    )59