Upload Phi-4-mini-flash-reasoning_1.py with huggingface_hub
Browse files
    	
        Phi-4-mini-flash-reasoning_1.py
    ADDED
    
    | @@ -0,0 +1,26 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 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("microsoft/Phi-4-mini-flash-reasoning", trust_remote_code=True)
         | 
| 13 | 
            +
                with open('Phi-4-mini-flash-reasoning_1.txt', 'w') as f:
         | 
| 14 | 
            +
                    f.write('Everything was good in Phi-4-mini-flash-reasoning_1')
         | 
| 15 | 
            +
            except Exception as e:
         | 
| 16 | 
            +
                with open('Phi-4-mini-flash-reasoning_1.txt', 'w') as f:
         | 
| 17 | 
            +
                    import traceback
         | 
| 18 | 
            +
                    traceback.print_exc(file=f)
         | 
| 19 | 
            +
            finally:
         | 
| 20 | 
            +
                from huggingface_hub import upload_file
         | 
| 21 | 
            +
                upload_file(
         | 
| 22 | 
            +
                    path_or_fileobj='Phi-4-mini-flash-reasoning_1.txt',
         | 
| 23 | 
            +
                    repo_id='model-metadata/custom_code_execution_files',
         | 
| 24 | 
            +
                    path_in_repo='Phi-4-mini-flash-reasoning_1.txt',
         | 
| 25 | 
            +
                    repo_type='dataset',
         | 
| 26 | 
            +
                )
         | 
