Created
May 2, 2025 17:22
-
-
Save S1ro1/5f53cf5befba4efdbd072fc59eba7b2a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import AutoModelForCausalLM | |
from accelerate import Accelerator | |
import torch | |
torch.cuda.memory._record_memory_history() | |
model_id = "meta-llama/Meta-Llama-3-8B-Instruct" | |
accelerator = Accelerator() | |
model = AutoModelForCausalLM.from_pretrained(model_id) | |
optimizer = torch.optim.AdamW(model.parameters(), lr=1e-5) | |
model, optimizer = accelerator.prepare(model, optimizer) | |
print(model) | |
torch.cuda.memory._dump_snapshot("pre-patch.pkl") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment