diff options
author | Jordan Gong <jordan.gong@protonmail.com> | 2021-01-14 16:50:23 +0800 |
---|---|---|
committer | Jordan Gong <jordan.gong@protonmail.com> | 2021-01-14 16:50:23 +0800 |
commit | db5a58b1db9875afbc2a4c7e6e5d190b6c28ee34 (patch) | |
tree | c8aea4a64d5635fab69f15cdf3a2dfa20c923761 | |
parent | ad5211cce95ed8756b7960527813e93847df6f82 (diff) |
Remove DataParallel
-rw-r--r-- | models/model.py | 11 | ||||
-rw-r--r-- | 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 = [], {} @@ -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 |