custom_code_py_files / Ovis-U1-3B_0.py
ariG23498's picture
ariG23498 HF Staff
Upload Ovis-U1-3B_0.py with huggingface_hub
3157796 verified
raw
history blame contribute delete
765 Bytes
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "transformers",
# "torch",
# ]
# ///
try:
# Load model directly
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("AIDC-AI/Ovis-U1-3B", trust_remote_code=True)
with open('Ovis-U1-3B_0.txt', 'w') as f:
f.write('Everything was good in Ovis-U1-3B_0')
except Exception as e:
with open('Ovis-U1-3B_0.txt', 'w') as f:
import traceback
traceback.print_exc(file=f)
finally:
from huggingface_hub import upload_file
upload_file(
path_or_fileobj='Ovis-U1-3B_0.txt',
repo_id='model-metadata/custom_code_execution_files',
path_in_repo='Ovis-U1-3B_0.txt',
repo_type='dataset',
)