ariG23498 HF Staff commited on
Commit
0780491
·
verified ·
1 Parent(s): 88b5292

Upload custom_code/17-06-25/deepseek-ai_DeepSeek-R1-0528_1.py with huggingface_hub

Browse files
custom_code/17-06-25/deepseek-ai_DeepSeek-R1-0528_1.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 AutoTokenizer, AutoModelForCausalLM
12
+
13
+ tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-R1-0528", trust_remote_code=True)
14
+ model = AutoModelForCausalLM.from_pretrained("deepseek-ai/DeepSeek-R1-0528", trust_remote_code=True)
15
+ except Exception as e:
16
+ with open(f'deepseek-ai_DeepSeek-R1-0528_1_exception.txt', 'w') as f:
17
+ import traceback
18
+ traceback.print_exc(file=f)
19
+ from huggingface_hub import upload_file
20
+ upload_file(
21
+ path_or_fileobj=f'deepseek-ai_DeepSeek-R1-0528_1_exception.txt',
22
+ repo_id='model-metadata/model-code-exception',
23
+ path_in_repo=f'17-06-25/deepseek-ai_DeepSeek-R1-0528_1_exception.txt',
24
+ repo_type='dataset',
25
+ )