Upload google_gemma-3n-E4B-it_4.py with huggingface_hub
Browse files123456789101112131415161718192021222324252627282930# /// script# requires-python = ">=3.12"# dependencies = [# "transformers",# "torch",# ]# ///
try: from transformers import AutoModelForImageTextToText, AutoProcessor processor = AutoProcessor.from_pretrained(GEMMA_PATH) model = AutoModelForImageTextToText.from_pretrained(GEMMA_PATH, torch_dtype="auto", device_map="auto") print(f"Device: {model.device}") print(f"DType: {model.dtype}") with open('google_gemma-3n-E4B-it_4.txt', 'w') as f: f.write('Everything was good in google_gemma-3n-E4B-it_4.txt')except Exception as e: with open('google_gemma-3n-E4B-it_4.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-3n-E4B-it_4.txt', repo_id='model-metadata/custom_code_execution_files', path_in_repo='google_gemma-3n-E4B-it_4.txt', repo_type='dataset', )google_gemma-3n-E4B-it_4.pyAdded+30