Upload cerebras_GLM-4.6-REAP-218B-A32B-FP8_0.py with huggingface_hub
Browse files
    	
        cerebras_GLM-4.6-REAP-218B-A32B-FP8_0.py
    CHANGED
    
    | 
         @@ -22,17 +22,30 @@ try: 
     | 
|
| 22 | 
         
             
                with open('cerebras_GLM-4.6-REAP-218B-A32B-FP8_0.txt', 'w', encoding='utf-8') as f:
         
     | 
| 23 | 
         
             
                    f.write('Everything was good in cerebras_GLM-4.6-REAP-218B-A32B-FP8_0.txt')
         
     | 
| 24 | 
         
             
            except Exception as e:
         
     | 
| 25 | 
         
            -
                 
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 26 | 
         
             
                    import traceback
         
     | 
| 27 | 
         
            -
                     
     | 
| 
         | 
|
| 
         | 
|
| 28 | 
         | 
| 29 | 
         
            -
             
     | 
| 30 | 
         
            -
             
     | 
| 31 | 
         
            -
             
     | 
| 32 | 
         
            -
             
     | 
| 33 | 
         
            -
             
     | 
| 34 | 
         
            -
             
     | 
| 35 | 
         
            -
             
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 36 | 
         
             
            finally:
         
     | 
| 37 | 
         
             
                from huggingface_hub import upload_file
         
     | 
| 38 | 
         
             
                upload_file(
         
     | 
| 
         | 
|
| 22 | 
         
             
                with open('cerebras_GLM-4.6-REAP-218B-A32B-FP8_0.txt', 'w', encoding='utf-8') as f:
         
     | 
| 23 | 
         
             
                    f.write('Everything was good in cerebras_GLM-4.6-REAP-218B-A32B-FP8_0.txt')
         
     | 
| 24 | 
         
             
            except Exception as e:
         
     | 
| 25 | 
         
            +
                import os
         
     | 
| 26 | 
         
            +
                from slack_sdk import WebClient
         
     | 
| 27 | 
         
            +
                client = WebClient(token=os.environ['SLACK_TOKEN'])
         
     | 
| 28 | 
         
            +
                client.chat_postMessage(
         
     | 
| 29 | 
         
            +
                    channel='#exp-slack-alerts',
         
     | 
| 30 | 
         
            +
                    text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/cerebras_GLM-4.6-REAP-218B-A32B-FP8_0.txt|cerebras_GLM-4.6-REAP-218B-A32B-FP8_0.txt>',
         
     | 
| 31 | 
         
            +
                )
         
     | 
| 32 | 
         
            +
             
     | 
| 33 | 
         
            +
                with open('cerebras_GLM-4.6-REAP-218B-A32B-FP8_0.txt', 'a', encoding='utf-8') as f:
         
     | 
| 34 | 
         
             
                    import traceback
         
     | 
| 35 | 
         
            +
                    f.write('```CODE: 
         
     | 
| 36 | 
         
            +
            # Use a pipeline as a high-level helper
         
     | 
| 37 | 
         
            +
            from transformers import pipeline
         
     | 
| 38 | 
         | 
| 39 | 
         
            +
            pipe = pipeline("text-generation", model="cerebras/GLM-4.6-REAP-218B-A32B-FP8")
         
     | 
| 40 | 
         
            +
            messages = [
         
     | 
| 41 | 
         
            +
                {"role": "user", "content": "Who are you?"},
         
     | 
| 42 | 
         
            +
            ]
         
     | 
| 43 | 
         
            +
            pipe(messages)
         
     | 
| 44 | 
         
            +
            ```
         
     | 
| 45 | 
         
            +
            ERROR: 
         
     | 
| 46 | 
         
            +
            ')
         
     | 
| 47 | 
         
            +
                    traceback.print_exc(file=f)
         
     | 
| 48 | 
         
            +
                
         
     | 
| 49 | 
         
             
            finally:
         
     | 
| 50 | 
         
             
                from huggingface_hub import upload_file
         
     | 
| 51 | 
         
             
                upload_file(
         
     |