From b5265637b79cf731d22952bb2e780035671ff362 Mon Sep 17 00:00:00 2001
From: janEbert <janpublicebert@posteo.net>
Date: Wed, 4 Jun 2025 16:08:00 +0200
Subject: [PATCH] Revert "Use meta device initialization"

This reverts commit 528e690f39966974f3e17509c4397002ee9db45a.

Initialization of the example networks is not sensibly implemented, so
we do not re-implement it at this point.
---
 pytorch-fsdp-example/main.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/pytorch-fsdp-example/main.py b/pytorch-fsdp-example/main.py
index ff3d4dd..1bcca57 100644
--- a/pytorch-fsdp-example/main.py
+++ b/pytorch-fsdp-example/main.py
@@ -376,12 +376,8 @@ def main():
 
     train_dset, valid_dset, test_dset = prepare_datasets(args, device)
 
-    with torch.device('meta'):
-        model = build_model(args)
+    model = build_model(args)
     model = distribute_model(model, args)
-    # Put model from meta device to actual device.
-    model.to_empty(device=device)
-    model.reset_parameters()
     loss_func = torch.nn.CrossEntropyLoss()
 
     lr = args.lr
-- 
GitLab