from transformers import AutoModelForCausalLM, AutoTokenizer import torch torch.manual_seed(0) # Set device to CPU for now device = 'cpu' # Load model and tokenizer model_id = 'gpt2' model = AutoModelForCausalLM.from_pretrained(model_id).to(device) tokenizer = AutoTokenizer.from_pretrained(model_id) # Print model size print(f"Model size: {model.get_memory_footprint():,} bytes")