Upload allenai_olmOCR-2-7B-1025_1.py with huggingface_hub
Browse files
allenai_olmOCR-2-7B-1025_1.py
CHANGED
|
@@ -19,17 +19,27 @@ try:
|
|
| 19 |
with open('allenai_olmOCR-2-7B-1025_1.txt', 'w', encoding='utf-8') as f:
|
| 20 |
f.write('Everything was good in allenai_olmOCR-2-7B-1025_1.txt')
|
| 21 |
except Exception as e:
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
import traceback
|
| 24 |
-
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
finally:
|
| 34 |
from huggingface_hub import upload_file
|
| 35 |
upload_file(
|
|
|
|
| 19 |
with open('allenai_olmOCR-2-7B-1025_1.txt', 'w', encoding='utf-8') as f:
|
| 20 |
f.write('Everything was good in allenai_olmOCR-2-7B-1025_1.txt')
|
| 21 |
except Exception as e:
|
| 22 |
+
import os
|
| 23 |
+
from slack_sdk import WebClient
|
| 24 |
+
client = WebClient(token=os.environ['SLACK_TOKEN'])
|
| 25 |
+
client.chat_postMessage(
|
| 26 |
+
channel='#exp-slack-alerts',
|
| 27 |
+
text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/allenai_olmOCR-2-7B-1025_1.txt|allenai_olmOCR-2-7B-1025_1.txt>',
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
with open('allenai_olmOCR-2-7B-1025_1.txt', 'a', encoding='utf-8') as f:
|
| 31 |
import traceback
|
| 32 |
+
f.write('```CODE:
|
| 33 |
+
# Load model directly
|
| 34 |
+
from transformers import AutoProcessor, AutoModelForVision2Seq
|
| 35 |
|
| 36 |
+
processor = AutoProcessor.from_pretrained("allenai/olmOCR-2-7B-1025")
|
| 37 |
+
model = AutoModelForVision2Seq.from_pretrained("allenai/olmOCR-2-7B-1025")
|
| 38 |
+
```
|
| 39 |
+
ERROR:
|
| 40 |
+
')
|
| 41 |
+
traceback.print_exc(file=f)
|
| 42 |
+
|
| 43 |
finally:
|
| 44 |
from huggingface_hub import upload_file
|
| 45 |
upload_file(
|