Upload Ovis-U1-3B_0.py with huggingface_hub
Browse files- Ovis-U1-3B_0.py +25 -0
Ovis-U1-3B_0.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.12"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "transformers",
|
| 5 |
+
# "torch",
|
| 6 |
+
# ]
|
| 7 |
+
# ///
|
| 8 |
+
|
| 9 |
+
try:
|
| 10 |
+
# Load model directly
|
| 11 |
+
from transformers import AutoModelForCausalLM
|
| 12 |
+
model = AutoModelForCausalLM.from_pretrained("AIDC-AI/Ovis-U1-3B", trust_remote_code=True)
|
| 13 |
+
except Exception as e:
|
| 14 |
+
exception_file = 'AIDC-AI_Ovis-U1-3B_0_exception.txt'
|
| 15 |
+
with open(exception_file, 'w') as f:
|
| 16 |
+
import traceback
|
| 17 |
+
traceback.print_exc(file=f)
|
| 18 |
+
# Upload exception log to HuggingFace
|
| 19 |
+
from huggingface_hub import upload_file
|
| 20 |
+
upload_file(
|
| 21 |
+
path_or_fileobj=exception_file,
|
| 22 |
+
repo_id='model-metadata/model-code-exception',
|
| 23 |
+
path_in_repo='09-07-25/AIDC-AI_Ovis-U1-3B_0_exception.txt',
|
| 24 |
+
repo_type='dataset',
|
| 25 |
+
)
|