Download HuggingFaceTB_SmolLM3-3B_2.py from model-metadata/custom_code_py_files: direct link, hf CLI and curl.
- Browser
- Download file 858 Bytes
-
https://huggingface.co/datasets/model-metadata/custom_code_py_files/resolve/d85594b452eeb0c1d53e94dea3bc3f3e2aeb3127/HuggingFaceTB_SmolLM3-3B_2.py
- Command line
-
hf download hf://datasets/model-metadata/custom_code_py_files@d85594b452eeb0c1d53e94dea3bc3f3e2aeb3127/HuggingFaceTB_SmolLM3-3B_2.py
-
curl -L -o HuggingFaceTB_SmolLM3-3B_2.py https://huggingface.co/datasets/model-metadata/custom_code_py_files/resolve/d85594b452eeb0c1d53e94dea3bc3f3e2aeb3127/HuggingFaceTB_SmolLM3-3B_2.py
858 Bytes
| # /// script | |
| # requires-python = ">=3.12" | |
| # dependencies = [ | |
| # "transformers", | |
| # "torch", | |
| # ] | |
| # /// | |
| try: | |
| messages = [ | |
| {"role": "system", "content": "/no_think"}, | |
| {"role": "user", "content": "Give me a brief explanation of gravity in simple terms."}, | |
| ] | |
| pipe(messages) | |
| with open('HuggingFaceTB_SmolLM3-3B_2.txt', 'w') as f: | |
| f.write('Everything was good in HuggingFaceTB_SmolLM3-3B_2.txt') | |
| except Exception as e: | |
| with open('HuggingFaceTB_SmolLM3-3B_2.txt', 'w') as f: | |
| import traceback | |
| traceback.print_exc(file=f) | |
| finally: | |
| from huggingface_hub import upload_file | |
| upload_file( | |
| path_or_fileobj='HuggingFaceTB_SmolLM3-3B_2.txt', | |
| repo_id='model-metadata/custom_code_execution_files', | |
| path_in_repo='HuggingFaceTB_SmolLM3-3B_2.txt', | |
| repo_type='dataset', | |
| ) |