Upload Kimi-K2-Base_1.py with huggingface_hub
Browse files1234567891011121314151617181920212223242526# /// script# requires-python = ">=3.12"# dependencies = [# "transformers",# "torch",# ]# ///
try: # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("moonshotai/Kimi-K2-Base", trust_remote_code=True) with open('Kimi-K2-Base_1.txt', 'w') as f: f.write('Everything was good in Kimi-K2-Base_1')except Exception as e: with open('Kimi-K2-Base_1.txt', 'w') as f: import traceback traceback.print_exc(file=f)finally: from huggingface_hub import upload_file upload_file( path_or_fileobj='Kimi-K2-Base_1.txt', repo_id='model-metadata/custom_code_execution_files', path_in_repo='Kimi-K2-Base_1.txt', repo_type='dataset', )Kimi-K2-Base_1.pyAdded+26