Team Ai
Datasetpublic

model-metadata/custom_code_py_files

sourceHugging Faceupdated 1y agoView on Hugging Face
1likes9.5kdownloads
deepseek-ai_DeepSeek-R1_0.py34 linesDownload Raw Back to root
1# /// script2# requires-python = ">=3.12"3# dependencies = [4#     "torch",5#     "torchvision",6#     "transformers",7#     "accelerate",8#     "peft",9# ]10# ///11 12try:13    # Use a pipeline as a high-level helper14    from transformers import pipeline15    16    pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1", trust_remote_code=True)17    messages = [18        {"role": "user", "content": "Who are you?"},19    ]20    pipe(messages)21    with open('deepseek-ai_DeepSeek-R1_0.txt', 'w') as f:22        f.write('Everything was good in deepseek-ai_DeepSeek-R1_0.txt')23except Exception as e:24    with open('deepseek-ai_DeepSeek-R1_0.txt', 'w') as f:25        import traceback26        traceback.print_exc(file=f)27finally:28    from huggingface_hub import upload_file29    upload_file(30        path_or_fileobj='deepseek-ai_DeepSeek-R1_0.txt',31        repo_id='model-metadata/custom_code_execution_files',32        path_in_repo='deepseek-ai_DeepSeek-R1_0.txt',33        repo_type='dataset',34    )