Download exp/exp_basic.py from cdcd2024/WaveLSFromer: direct link, hf CLI and curl.
- Browser
- Download file 952 Bytes
-
https://huggingface.co/cdcd2024/WaveLSFromer/resolve/main/exp/exp_basic.py
- Command line
-
hf download hf://cdcd2024/WaveLSFromer/exp/exp_basic.py
-
curl -L -o exp_basic.py https://huggingface.co/cdcd2024/WaveLSFromer/resolve/main/exp/exp_basic.py
952 Bytes
| import os | |
| import torch | |
| import numpy as np | |
| class Exp_Basic(object): | |
| def __init__(self, args): | |
| self.args = args | |
| self.device = self._acquire_device() | |
| self.model = self._build_model().to(self.device) | |
| def _build_model(self): | |
| raise NotImplementedError | |
| return None | |
| def _acquire_device(self): | |
| if self.args.use_gpu: | |
| os.environ["CUDA_VISIBLE_DEVICES"] = ( | |
| str(self.args.gpu) if not self.args.use_multi_gpu else self.args.devices | |
| ) | |
| device = torch.device(f"cuda:{self.args.gpu}") | |
| print(f"Use GPU: cuda:{self.args.gpu}") | |
| else: | |
| device = torch.device("cpu") | |
| print("Use CPU") | |
| return device | |
| def _get_data(self, *args, **kwargs): | |
| pass | |
| def vali(self, *args, **kwargs): | |
| pass | |
| def train(self, *args, **kwargs): | |
| pass | |
| def test(self, *args, **kwargs): | |
| pass | |