ariG23498 HF Staff commited on
Commit
ff99b75
·
verified ·
1 Parent(s): 7541f2a

Upload mirth_chonky_mmbert_small_multilingual_1_1.py with huggingface_hub

Browse files
mirth_chonky_mmbert_small_multilingual_1_1.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.12"
3
+ # dependencies = [
4
+ # "torch",
5
+ # "torchvision",
6
+ # "transformers",
7
+ # "accelerate",
8
+ # "peft",
9
+ # ]
10
+ # ///
11
+
12
+ try:
13
+ # Load model directly
14
+ from transformers import AutoTokenizer, AutoModelForTokenClassification
15
+
16
+ tokenizer = AutoTokenizer.from_pretrained("mirth/chonky_mmbert_small_multilingual_1")
17
+ model = AutoModelForTokenClassification.from_pretrained("mirth/chonky_mmbert_small_multilingual_1")
18
+ with open('mirth_chonky_mmbert_small_multilingual_1_1.txt', 'w', encoding='utf-8') as f:
19
+ f.write('Everything was good in mirth_chonky_mmbert_small_multilingual_1_1.txt')
20
+ except Exception as e:
21
+ with open('mirth_chonky_mmbert_small_multilingual_1_1.txt', 'w', encoding='utf-8') as f:
22
+ import traceback
23
+ traceback.print_exc(file=f)
24
+ finally:
25
+ from huggingface_hub import upload_file
26
+ upload_file(
27
+ path_or_fileobj='mirth_chonky_mmbert_small_multilingual_1_1.txt',
28
+ repo_id='model-metadata/code_execution_files',
29
+ path_in_repo='mirth_chonky_mmbert_small_multilingual_1_1.txt',
30
+ repo_type='dataset',
31
+ )