Upload ERNIE-4.5-VL-424B-A47B-Base-PT with huggingface_hub
Browse files
ERNIE-4.5-VL-424B-A47B-Base-PT
CHANGED
|
@@ -7,22 +7,11 @@
|
|
| 7 |
# ///
|
| 8 |
|
| 9 |
try:
|
| 10 |
-
#
|
| 11 |
-
from transformers import
|
| 12 |
-
|
| 13 |
-
pipe = pipeline("image-text-to-text", model="baidu/ERNIE-4.5-VL-424B-A47B-Base-PT", trust_remote_code=True)
|
| 14 |
-
messages = [
|
| 15 |
-
{
|
| 16 |
-
"role": "user",
|
| 17 |
-
"content": [
|
| 18 |
-
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
|
| 19 |
-
{"type": "text", "text": "What animal is on the candy?"}
|
| 20 |
-
]
|
| 21 |
-
},
|
| 22 |
-
]
|
| 23 |
-
pipe(text=messages)
|
| 24 |
except Exception as e:
|
| 25 |
-
exception_file = 'baidu_ERNIE-4.5-VL-424B-A47B-Base-
|
| 26 |
with open(exception_file, 'w') as f:
|
| 27 |
import traceback
|
| 28 |
traceback.print_exc(file=f)
|
|
@@ -31,6 +20,6 @@ except Exception as e:
|
|
| 31 |
upload_file(
|
| 32 |
path_or_fileobj=exception_file,
|
| 33 |
repo_id='model-metadata/model-code-exception',
|
| 34 |
-
path_in_repo='09-07-25/baidu_ERNIE-4.5-VL-424B-A47B-Base-
|
| 35 |
repo_type='dataset',
|
| 36 |
)
|
|
|
|
| 7 |
# ///
|
| 8 |
|
| 9 |
try:
|
| 10 |
+
# Load model directly
|
| 11 |
+
from transformers import AutoModel
|
| 12 |
+
model = AutoModel.from_pretrained("baidu/ERNIE-4.5-VL-424B-A47B-Base-PT", trust_remote_code=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
except Exception as e:
|
| 14 |
+
exception_file = 'baidu_ERNIE-4.5-VL-424B-A47B-Base-PT_1_exception.txt'
|
| 15 |
with open(exception_file, 'w') as f:
|
| 16 |
import traceback
|
| 17 |
traceback.print_exc(file=f)
|
|
|
|
| 20 |
upload_file(
|
| 21 |
path_or_fileobj=exception_file,
|
| 22 |
repo_id='model-metadata/model-code-exception',
|
| 23 |
+
path_in_repo='09-07-25/baidu_ERNIE-4.5-VL-424B-A47B-Base-PT_1_exception.txt',
|
| 24 |
repo_type='dataset',
|
| 25 |
)
|