ariG23498 HF Staff commited on
Commit
1aac7f1
·
verified ·
1 Parent(s): b44d251

Upload custom_code/17-06-25/openbmb_MiniCPM4-8B_1.py with huggingface_hub

Browse files
custom_code/17-06-25/openbmb_MiniCPM4-8B_1.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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("openbmb/MiniCPM4-8B", trust_remote_code=True)
13
+ except Exception as e:
14
+ with open(f'openbmb_MiniCPM4-8B_1_exception.txt', 'w') as f:
15
+ import traceback
16
+ traceback.print_exc(file=f)
17
+ from huggingface_hub import upload_file
18
+ upload_file(
19
+ path_or_fileobj=f'openbmb_MiniCPM4-8B_1_exception.txt',
20
+ repo_id='model-metadata/model-code-exception',
21
+ path_in_repo=f'17-06-25/openbmb_MiniCPM4-8B_1_exception.txt',
22
+ repo_type='dataset',
23
+ )