Upload google_gemma-3-1b-it_1.py with huggingface_hub
Browse files123456789101112131415161718192021222324252627282930313233343536# /// script# requires-python = ">=3.12"# dependencies = [# "numpy",# "einops",# "torch",# "transformers",# "datasets",# "accelerate",# "timm",# ]# ///
try: # Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="google/gemma-3-1b-it") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages) with open('google_gemma-3-1b-it_1.txt', 'w') as f: f.write('Everything was good in google_gemma-3-1b-it_1.txt')except Exception as e: with open('google_gemma-3-1b-it_1.txt', 'w') as f: import traceback traceback.print_exc(file=f)finally: from huggingface_hub import upload_file upload_file( path_or_fileobj='google_gemma-3-1b-it_1.txt', repo_id='model-metadata/custom_code_execution_files', path_in_repo='google_gemma-3-1b-it_1.txt', repo_type='dataset', )google_gemma-3-1b-it_1.pyAdded+36