IDE and Useful Tools

IDE and Useful Tools

This section is intended to recommend an IDE and helpful tools for beginners running FedPruning. If you already have a preferred IDE and tools, feel free to skip this section.

IDE Setup

Since FedPruning is built with Python, we recommend beginners use either VSCode or PyCharm. In this guide, we’ll provide instructions for setting up VSCode.

Installing VSCode

You can download VSCode for your system from its official website. It’s free to use.

Installing Extension

As many users run their code on a remote server, VSCode offers functionality for working with files on remote machines. To enhance your workflow, install the necessary extensions for remote development in VSCode:

  1. Open the Extensions view by clicking the square icon in the sidebar or by pressing Ctrl+Shift+X.

  2. In the search bar, type Remote - SSH and Remote Development.

  3. Install both the Remote - SSH and Remote Development.

Remote - SSH
Remote Development

Access to the Remote Server

Step 1: follow these steps to open the configuration file in the Remote Explorer :

Open the configuration file in the Remote Explorer

Step 2: Edit the configuration file to connect to the remote server.

Direct Connection Example: If the server IP is 192.0.0.1 and the username is hong, add the following lines:

Using a Jump Server: If you need to connect via a jump server (e.g., the IP is jumpserver.com), add the following lines:

Save the configuration file. You should now see the target server listed in the Remote Explorer:

remote server in the Remote Explorer

Step 3: select remote_server from the Remote Explorer. If using a jump server, you’ll first be prompted to enter the jump server password, followed by the remote server password. Once connected, you can access the file system and open a remote terminal directly on the server.

Some Useful tools

We recommend some helpful tools to make running FedPruning more efficient and comfortable.

Tmux

When running multiple experiments, especially those that take a long time, closing the terminal can stop your code. To avoid this, we recommend using Tmux, which allows you to manage multiple terminal session and run experiments in the background. This guide will cover basic Tmux usage, but you can find more detailed documentation here.

Example: Running Two Python Files Simultaneously

In this example, we will run two Python files, test1.py and test2.py, at the same time.

Installation

To install Tmux, run:

Opening a New Session

To run test1.py, first create a new Tmux session, naming it s1, by entering the following in the terminal:

This will open a new session (s1) with a default window. You can now run test1.py inside this session.

Detach a Session

While test1.py is running, you’ll want to start test2.py. To do so, you need to detach from the current session. Press Ctrl+B (Control+B), then press D to detach and return to the main terminal. You can now open a new session to run the second Python file.

Attach to a Session

If you want to check the progress of test1.py, you can re-enter the s1 session by using the following command:

Delet a Session

To delete an unused session, for example, s1, simply use this command:

gpustat

gpustat is a tool that shows GPU memory statistics. To install it, run:

Once installed, you can check the GPU status by entering:

Weights & Biases (WandB)

Weights & Biases (WandB) is a machine learning development platform that enables users to track and visualize various aspects of their model training in real-time. To install it, run the following command:

After installation, you’ll need to log in to WandB to start tracking your experiments. To do this, run:

Follow the instructions to enter your API key.

FedPruning already includes WandB integration, so when you run FedPruning, you can monitor your model’s training progress on the WandB website at https://wandb.ai/home. Below is an overview of the WandB workspace:

Overview of the WandB workspace

If you don’t want to upload experiment data while testing or debugging, you can switch to offline mode by running:

WandB will stop sending data until you switch back to online mode by running:

For more details on how to use WandB in projects, refer to the official documentation at https://docs.wandb.ai/.

Last updated