From db5a58b1db9875afbc2a4c7e6e5d190b6c28ee34 Mon Sep 17 00:00:00 2001 From: Jordan Gong Date: Thu, 14 Jan 2021 16:50:23 +0800 Subject: Remove DataParallel --- models/model.py | 11 ++--------- startup | 9 ++++++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/models/model.py b/models/model.py index c6a1234..740cdf3 100644 --- a/models/model.py +++ b/models/model.py @@ -137,7 +137,7 @@ class Model: sched_hp = self.hp.get('scheduler', {}) self.rgb_pn = RGBPartNet(self.train_size, self.in_channels, **model_hp) # Try to accelerate computation using CUDA or others - self.rgb_pn = self._accelerate(self.rgb_pn) + self.rgb_pn = self.rgb_pn.to(self.device) self.optimizer = optim.Adam(self.rgb_pn.parameters(), **optim_hp) self.scheduler = optim.lr_scheduler.StepLR(self.optimizer, **sched_hp) self.writer = SummaryWriter(self._log_name) @@ -196,13 +196,6 @@ class Model: self.writer.close() break - def _accelerate(self, model: nn.Module) -> nn.Module: - if not self.disable_acc: - if torch.cuda.device_count() > 1: - model = nn.DataParallel(model) - model = model.to(self.device) - return model - def predict_all( self, iter_: int, @@ -225,7 +218,7 @@ class Model: model_hp = self.hp.get('model', {}) self.rgb_pn = RGBPartNet(ae_in_channels=self.in_channels, **model_hp) # Try to accelerate computation using CUDA or others - self.rgb_pn = self._accelerate(self.rgb_pn) + self.rgb_pn = self.rgb_pn.to(self.device) self.rgb_pn.eval() gallery_samples, probe_samples = [], {} diff --git a/startup b/startup index a7253dd..644e59b 100644 --- a/startup +++ b/startup @@ -2,17 +2,20 @@ snap remove lxd snap remove core18 -apt -y purge snapd gdm3 +apt -y purge snapd gdm3 colord accountsservice rsyslog switcheroo-control \ + network-manager multipath-tools modemmanager upower rtkit policykit-1 apt -y autoremove apt update apt -y install python3-pip python-is-python3 nvtop zstd rclone -pip3 install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html +pip3 install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio===0.7.2 \ + -f https://download.pytorch.org/whl/torch_stable.html pip3 install scikit-learn tqdm tensorboard +cd /root + git clone https://git.jordangong.com/jordangong/gait-recognition.git -cd gait-recognition; git checkout python3.8; cd .. mkdir -p gait-recognition/data/CASIA-B-MRCNN wget https://storage.googleapis.com/gait-dataset/CASIA-B-MRCNN-SEG.tar.zst tar -I zstd -xf CASIA-B-MRCNN-SEG.tar.zst -C gait-recognition/data/CASIA-B-MRCNN -- cgit v1.2.3