model-metadata/custom_code_py_files
19.5k
1# /// script2# requires-python = ">=3.12"3# dependencies = [4# "transformers",5# "torch",6# ]7# ///8 9try:10 # Load model directly11 from transformers import AutoTokenizer, AutoModelForCausalLM12 13 tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-R1", trust_remote_code=True)14 model = AutoModelForCausalLM.from_pretrained("deepseek-ai/DeepSeek-R1", trust_remote_code=True)15 with open('DeepSeek-R1_1.txt', 'w') as f:16 f.write('Everything was good in DeepSeek-R1_1')17except Exception as e:18 with open('DeepSeek-R1_1.txt', 'w') as f:19 import traceback20 traceback.print_exc(file=f)21finally:22 from huggingface_hub import upload_file23 upload_file(24 path_or_fileobj='DeepSeek-R1_1.txt',25 repo_id='model-metadata/custom_code_execution_files',26 path_in_repo='DeepSeek-R1_1.txt',27 repo_type='dataset',28 )