Sadjad Alikhani
commited on
Update README.md
Browse files
README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
**[🚀 Click here to try the Interactive Demo!](https://huggingface.co/spaces/sadjadalikhani/lwm-interactive-demo)**
|
| 4 |
|
| 5 |
-
Welcome to
|
| 6 |
|
| 7 |
---
|
| 8 |
|
|
@@ -10,32 +10,32 @@ Welcome to the **LWM** (Large Wireless Model) repository! This project hosts a p
|
|
| 10 |
|
| 11 |
### 1. **Install Conda or Mamba (via Miniforge)**
|
| 12 |
|
| 13 |
-
First,
|
| 14 |
|
| 15 |
#### **Option A: Install Conda**
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
- **Anaconda** includes a
|
| 20 |
-
- **Miniconda** is a lightweight version that only
|
| 21 |
|
| 22 |
#### **Option B: Install Mamba (via Miniforge)**
|
| 23 |
|
| 24 |
-
|
| 25 |
|
| 26 |
-
- **Miniforge** is a smaller
|
| 27 |
|
| 28 |
-
|
| 29 |
|
| 30 |
---
|
| 31 |
|
| 32 |
### 2. **Create a New Environment**
|
| 33 |
|
| 34 |
-
|
| 35 |
|
| 36 |
#### **Step 1: Create a new environment**
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
```bash
|
| 41 |
conda create -n lwm_env
|
|
@@ -43,7 +43,7 @@ conda create -n lwm_env
|
|
| 43 |
|
| 44 |
#### **Step 2: Activate the environment**
|
| 45 |
|
| 46 |
-
Activate the environment
|
| 47 |
|
| 48 |
```bash
|
| 49 |
conda activate lwm_env
|
|
@@ -51,30 +51,37 @@ conda activate lwm_env
|
|
| 51 |
|
| 52 |
---
|
| 53 |
|
| 54 |
-
|
| 55 |
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
-
# Install CUDA-enabled Pytorch
|
| 59 |
```bash
|
| 60 |
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
|
| 61 |
```
|
| 62 |
-
Note: If you have trouble installing the CUDA-enabled Pytorch, make sure the cuda version is compatibnle with your system. It can also because you have tried multiple install scripts. Try a new environment.
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
| 65 |
```bash
|
| 66 |
conda install python numpy pandas matplotlib tqdm -c conda-forge
|
| 67 |
```
|
| 68 |
-
|
|
|
|
|
|
|
| 69 |
```bash
|
| 70 |
pip install DeepMIMOv3
|
| 71 |
```
|
| 72 |
|
| 73 |
---
|
| 74 |
|
| 75 |
-
###
|
| 76 |
|
| 77 |
-
The following functions will help you clone specific dataset scenarios:
|
| 78 |
|
| 79 |
```python
|
| 80 |
import subprocess
|
|
@@ -104,21 +111,15 @@ def clone_dataset_scenario(scenario_name, repo_url, model_repo_dir="./LWM", scen
|
|
| 104 |
subprocess.run(["git", "lfs", "pull"], cwd=scenarios_path, check=True)
|
| 105 |
|
| 106 |
print(f"Successfully cloned {scenario_name} into {scenarios_path}.")
|
| 107 |
-
|
| 108 |
-
# Function to clone multiple dataset scenarios
|
| 109 |
-
def clone_dataset_scenarios(selected_scenario_names, dataset_repo_url, model_repo_dir):
|
| 110 |
-
for scenario_name in selected_scenario_names:
|
| 111 |
-
clone_dataset_scenario(scenario_name, dataset_repo_url, model_repo_dir)
|
| 112 |
```
|
| 113 |
|
| 114 |
---
|
| 115 |
|
| 116 |
-
###
|
| 117 |
|
| 118 |
-
|
| 119 |
|
| 120 |
```bash
|
| 121 |
-
|
| 122 |
# Step 1: Clone the model repository (if not already cloned)
|
| 123 |
model_repo_url = "https://huggingface.co/sadjadalikhani/lwm"
|
| 124 |
model_repo_dir = "./LWM"
|
|
@@ -130,9 +131,9 @@ if not os.path.exists(model_repo_dir):
|
|
| 130 |
|
| 131 |
---
|
| 132 |
|
| 133 |
-
###
|
| 134 |
|
| 135 |
-
|
| 136 |
|
| 137 |
📊 **Dataset Overview**
|
| 138 |
|
|
@@ -145,36 +146,25 @@ Before proceeding with tokenization and data processing, the **DeepMIMO** datase
|
|
| 145 |
| Dataset 4 | 🌉 Santa Clara | 2689 | [DeepMIMO City Scenario 11](https://www.deepmimo.net/scenarios/deepmimo-city-scenario11/) |
|
| 146 |
| Dataset 5 | 🌅 San Diego | 2192 | [DeepMIMO City Scenario 7](https://www.deepmimo.net/scenarios/deepmimo-city-scenario7/) |
|
| 147 |
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
#### **Operational Settings**:
|
| 151 |
-
- **Antennas at BS**: 32
|
| 152 |
-
- **Antennas at UEs**: 1
|
| 153 |
-
- **Subcarriers**: 32
|
| 154 |
-
- **Paths**: 20
|
| 155 |
-
|
| 156 |
```python
|
| 157 |
-
# Step 2: Clone specific dataset scenario folder(s) inside the "scenarios" folder
|
| 158 |
dataset_repo_url = "https://huggingface.co/datasets/sadjadalikhani/lwm" # Base URL for dataset repo
|
| 159 |
-
scenario_names = np.array([
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
)
|
| 166 |
-
|
| 167 |
-
# Choose the desired scenario or secanrios (if you need the combined scenarios as a larger and more diverse scenario.).
|
| 168 |
-
scenario_idxs = np.array([0,1,2,3,4,5,6])
|
| 169 |
selected_scenario_names = scenario_names[scenario_idxs]
|
| 170 |
|
| 171 |
-
# Clone the requested
|
| 172 |
clone_dataset_scenarios(selected_scenario_names, dataset_repo_url, model_repo_dir)
|
| 173 |
```
|
| 174 |
|
| 175 |
---
|
| 176 |
|
| 177 |
-
###
|
|
|
|
| 178 |
```bash
|
| 179 |
if os.path.exists(model_repo_dir):
|
| 180 |
os.chdir(model_repo_dir)
|
|
@@ -185,16 +175,20 @@ else:
|
|
| 185 |
|
| 186 |
---
|
| 187 |
|
| 188 |
-
###
|
|
|
|
|
|
|
| 189 |
|
| 190 |
```python
|
| 191 |
from input_preprocess import tokenizer
|
| 192 |
from lwm_model import lwm
|
| 193 |
import torch
|
| 194 |
|
| 195 |
-
preprocessed_chs = tokenizer(
|
| 196 |
-
|
| 197 |
-
|
|
|
|
|
|
|
| 198 |
|
| 199 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 200 |
print(f"Loading the LWM model on {device}...")
|
|
@@ -203,11 +197,15 @@ model = lwm.from_pretrained(device=device)
|
|
| 203 |
|
| 204 |
---
|
| 205 |
|
| 206 |
-
###
|
|
|
|
|
|
|
|
|
|
| 207 |
```python
|
| 208 |
from inference import lwm_inference, create_raw_dataset
|
| 209 |
input_types = ['cls_emb', 'channel_emb', 'raw']
|
| 210 |
selected_input_type = input_types[0]
|
|
|
|
| 211 |
if selected_input_type in ['cls_emb', 'channel_emb']:
|
| 212 |
dataset = lwm_inference(preprocessed_chs, selected_input_type, model, device)
|
| 213 |
else:
|
|
@@ -216,11 +214,12 @@ else:
|
|
| 216 |
|
| 217 |
---
|
| 218 |
|
| 219 |
-
###
|
|
|
|
|
|
|
| 220 |
|
| 221 |
-
If you'd like to explore **LWM** interactively, check out the demo hosted on Hugging Face Spaces:
|
| 222 |
[**Try the Interactive Demo!**](https://huggingface.co/spaces/sadjadalikhani/LWM-Interactive-Demo)
|
| 223 |
|
| 224 |
---
|
| 225 |
|
| 226 |
-
|
|
|
|
| 2 |
|
| 3 |
**[🚀 Click here to try the Interactive Demo!](https://huggingface.co/spaces/sadjadalikhani/lwm-interactive-demo)**
|
| 4 |
|
| 5 |
+
Welcome to **LWM** (Large Wireless Model) — a pre-trained model designed for processing and feature extraction from wireless communication datasets, particularly the **DeepMIMO** dataset. This guide provides step-by-step instructions to set up your environment, install the required packages, clone the repository, load data, and perform inference using LWM.
|
| 6 |
|
| 7 |
---
|
| 8 |
|
|
|
|
| 10 |
|
| 11 |
### 1. **Install Conda or Mamba (via Miniforge)**
|
| 12 |
|
| 13 |
+
First, ensure that you have a package manager like **Conda** or **Mamba** installed to manage your Python environments and packages.
|
| 14 |
|
| 15 |
#### **Option A: Install Conda**
|
| 16 |
|
| 17 |
+
You can install **Conda** via **Anaconda** or **Miniconda**.
|
| 18 |
|
| 19 |
+
- **Anaconda** includes a comprehensive scientific package suite. Download it [here](https://www.anaconda.com/products/distribution).
|
| 20 |
+
- **Miniconda** is a lightweight version that includes only Conda and Python. Download it [here](https://docs.conda.io/en/latest/miniconda.html).
|
| 21 |
|
| 22 |
#### **Option B: Install Mamba (via Miniforge)**
|
| 23 |
|
| 24 |
+
For a faster alternative, use **Mamba** by installing **Miniforge**.
|
| 25 |
|
| 26 |
+
- **Miniforge** is a smaller installer that comes with **Mamba**. Download it [here](https://github.com/conda-forge/miniforge/releases/latest).
|
| 27 |
|
| 28 |
+
Once installed, you can use Conda to manage environments.
|
| 29 |
|
| 30 |
---
|
| 31 |
|
| 32 |
### 2. **Create a New Environment**
|
| 33 |
|
| 34 |
+
After installing Conda (https://conda.io/projects/conda/en/latest/user-guide/install/index.html), follow these steps to create a new environment and install the required packages.
|
| 35 |
|
| 36 |
#### **Step 1: Create a new environment**
|
| 37 |
|
| 38 |
+
Create a new environment named `lwm_env`:
|
| 39 |
|
| 40 |
```bash
|
| 41 |
conda create -n lwm_env
|
|
|
|
| 43 |
|
| 44 |
#### **Step 2: Activate the environment**
|
| 45 |
|
| 46 |
+
Activate the environment:
|
| 47 |
|
| 48 |
```bash
|
| 49 |
conda activate lwm_env
|
|
|
|
| 51 |
|
| 52 |
---
|
| 53 |
|
| 54 |
+
### 3. **Install Required Packages**
|
| 55 |
|
| 56 |
+
Once the environment is activated, install the necessary packages.
|
| 57 |
+
|
| 58 |
+
#### **Install CUDA-enabled PyTorch**
|
| 59 |
+
|
| 60 |
+
Change the `pytorch-cuda` version based on your system requirements.
|
| 61 |
|
|
|
|
| 62 |
```bash
|
| 63 |
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
|
| 64 |
```
|
|
|
|
| 65 |
|
| 66 |
+
> **Note:** If you encounter issues installing CUDA-enabled PyTorch, verify your CUDA version compatibility. It might also be due to conflicting installation attempts—try a fresh environment.
|
| 67 |
+
|
| 68 |
+
#### **Install Other Required Packages via Conda Forge**
|
| 69 |
+
|
| 70 |
```bash
|
| 71 |
conda install python numpy pandas matplotlib tqdm -c conda-forge
|
| 72 |
```
|
| 73 |
+
|
| 74 |
+
#### **Install DeepMIMOv3 with pip**
|
| 75 |
+
|
| 76 |
```bash
|
| 77 |
pip install DeepMIMOv3
|
| 78 |
```
|
| 79 |
|
| 80 |
---
|
| 81 |
|
| 82 |
+
### 4. **Clone the Dataset Scenarios**
|
| 83 |
|
| 84 |
+
The following functions will help you clone specific dataset scenarios from a repository:
|
| 85 |
|
| 86 |
```python
|
| 87 |
import subprocess
|
|
|
|
| 111 |
subprocess.run(["git", "lfs", "pull"], cwd=scenarios_path, check=True)
|
| 112 |
|
| 113 |
print(f"Successfully cloned {scenario_name} into {scenarios_path}.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
```
|
| 115 |
|
| 116 |
---
|
| 117 |
|
| 118 |
+
### 5. **Clone the Model Repository**
|
| 119 |
|
| 120 |
+
Now, clone the **LWM** model repository to your local system.
|
| 121 |
|
| 122 |
```bash
|
|
|
|
| 123 |
# Step 1: Clone the model repository (if not already cloned)
|
| 124 |
model_repo_url = "https://huggingface.co/sadjadalikhani/lwm"
|
| 125 |
model_repo_dir = "./LWM"
|
|
|
|
| 131 |
|
| 132 |
---
|
| 133 |
|
| 134 |
+
### 6. **Clone the Desired Dataset Scenarios**
|
| 135 |
|
| 136 |
+
You can now clone specific scenarios from the DeepMIMO dataset, as detailed in the table below:
|
| 137 |
|
| 138 |
📊 **Dataset Overview**
|
| 139 |
|
|
|
|
| 146 |
| Dataset 4 | 🌉 Santa Clara | 2689 | [DeepMIMO City Scenario 11](https://www.deepmimo.net/scenarios/deepmimo-city-scenario11/) |
|
| 147 |
| Dataset 5 | 🌅 San Diego | 2192 | [DeepMIMO City Scenario 7](https://www.deepmimo.net/scenarios/deepmimo-city-scenario7/) |
|
| 148 |
|
| 149 |
+
#### **Clone the Scenarios:**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
```python
|
|
|
|
| 151 |
dataset_repo_url = "https://huggingface.co/datasets/sadjadalikhani/lwm" # Base URL for dataset repo
|
| 152 |
+
scenario_names = np.array([
|
| 153 |
+
"city_18_denver", "city_15_indianapolis", "city_19_oklahoma",
|
| 154 |
+
"city_12_fortworth", "city_11_santaclara", "city_7_sandiego"
|
| 155 |
+
])
|
| 156 |
+
|
| 157 |
+
scenario_idxs = np.array([0, 1, 2, 3, 4, 5]) # Select the scenario indexes
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
selected_scenario_names = scenario_names[scenario_idxs]
|
| 159 |
|
| 160 |
+
# Clone the requested scenarios
|
| 161 |
clone_dataset_scenarios(selected_scenario_names, dataset_repo_url, model_repo_dir)
|
| 162 |
```
|
| 163 |
|
| 164 |
---
|
| 165 |
|
| 166 |
+
### 7. **Change the Working Directory to LWM**
|
| 167 |
+
|
| 168 |
```bash
|
| 169 |
if os.path.exists(model_repo_dir):
|
| 170 |
os.chdir(model_repo_dir)
|
|
|
|
| 175 |
|
| 176 |
---
|
| 177 |
|
| 178 |
+
### 8. **Tokenize and Load the Model**
|
| 179 |
+
|
| 180 |
+
Now, tokenize the dataset and load the pre-trained LWM model.
|
| 181 |
|
| 182 |
```python
|
| 183 |
from input_preprocess import tokenizer
|
| 184 |
from lwm_model import lwm
|
| 185 |
import torch
|
| 186 |
|
| 187 |
+
preprocessed_chs = tokenizer(
|
| 188 |
+
selected_scenario_names=selected_scenario_names,
|
| 189 |
+
manual_data=None,
|
| 190 |
+
gen_raw=True
|
| 191 |
+
)
|
| 192 |
|
| 193 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 194 |
print(f"Loading the LWM model on {device}...")
|
|
|
|
| 197 |
|
| 198 |
---
|
| 199 |
|
| 200 |
+
### 9. **Perform Inference**
|
| 201 |
+
|
| 202 |
+
You can now perform inference on the preprocessed data using the LWM model.
|
| 203 |
+
|
| 204 |
```python
|
| 205 |
from inference import lwm_inference, create_raw_dataset
|
| 206 |
input_types = ['cls_emb', 'channel_emb', 'raw']
|
| 207 |
selected_input_type = input_types[0]
|
| 208 |
+
|
| 209 |
if selected_input_type in ['cls_emb', 'channel_emb']:
|
| 210 |
dataset = lwm_inference(preprocessed_chs, selected_input_type, model, device)
|
| 211 |
else:
|
|
|
|
| 214 |
|
| 215 |
---
|
| 216 |
|
| 217 |
+
### 10. **Explore the Interactive Demo**
|
| 218 |
+
|
| 219 |
+
To experience **LWM** interactively, visit our demo hosted on Hugging Face Spaces:
|
| 220 |
|
|
|
|
| 221 |
[**Try the Interactive Demo!**](https://huggingface.co/spaces/sadjadalikhani/LWM-Interactive-Demo)
|
| 222 |
|
| 223 |
---
|
| 224 |
|
| 225 |
+
You're now ready to explore the power of **LWM** in wireless communications! Start processing datasets and generate high-quality embeddings to advance your research or applications.
|