model-metadata/code_python_files
014k
1# /// script2# requires-python = ">=3.12"3# dependencies = [4# "torch",5# "torchvision",6# "transformers",7# "accelerate",8# "peft",9# "slack-sdk",10# ]11# ///12 13try:14 # Use a pipeline as a high-level helper15 from transformers import pipeline16 17 pipe = pipeline("image-text-to-text", model="Open-Bee/Bee-8B-RL", trust_remote_code=True)18 messages = [19 {20 "role": "user",21 "content": [22 {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},23 {"type": "text", "text": "What animal is on the candy?"}24 ]25 },26 ]27 pipe(text=messages)28 with open('Open-Bee_Bee-8B-RL_0.txt', 'w', encoding='utf-8') as f:29 f.write('Everything was good in Open-Bee_Bee-8B-RL_0.txt')30except Exception as e:31 import os32 from slack_sdk import WebClient33 client = WebClient(token=os.environ['SLACK_TOKEN'])34 client.chat_postMessage(35 channel='#exp-slack-alerts',36 text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/Open-Bee_Bee-8B-RL_0.txt|Open-Bee_Bee-8B-RL_0.txt>',37 )38 39 with open('Open-Bee_Bee-8B-RL_0.txt', 'a', encoding='utf-8') as f:40 import traceback41 f.write('''```CODE: 42# Use a pipeline as a high-level helper43from transformers import pipeline44 45pipe = pipeline("image-text-to-text", model="Open-Bee/Bee-8B-RL", trust_remote_code=True)46messages = [47 {48 "role": "user",49 "content": [50 {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},51 {"type": "text", "text": "What animal is on the candy?"}52 ]53 },54]55pipe(text=messages)56```57 58ERROR: 59''')60 traceback.print_exc(file=f)61 62finally:63 from huggingface_hub import upload_file64 upload_file(65 path_or_fileobj='Open-Bee_Bee-8B-RL_0.txt',66 repo_id='model-metadata/code_execution_files',67 path_in_repo='Open-Bee_Bee-8B-RL_0.txt',68 repo_type='dataset',69 )70 