Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
settings:
director_host: localhost
director_port: 50050

Portland:
private_attributes: private_attributes.portland_attrs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from datasets import load_from_disk

portland_attrs = {
"train_dataset": load_from_disk("../data/imdb_train_portland"),
"test_dataset": load_from_disk("../data/imdb_test_portland"),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# HuggingFace

## **How to run this tutorial (without TLS and locally as a simulation):**
<br/>

### 0. If you haven't done so already, create a virtual environment, install OpenFL, and upgrade pip:
- For help with this step, visit the "Install the Package" section of the [OpenFL installation instructions](https://openfl.readthedocs.io/en/latest/installation.html).

<br/>

### 1. Split terminal into 4 (1 terminal for the director, 2 for the envoys, and 1 for the experiment)

<br/>

### 2. Do the following in each terminal:
- Activate the virtual environment from step 0:

```sh
source venv/bin/activate
```
- If you are in a network environment with a proxy, ensure proxy environment variables are set in each of your terminals.
- Navigate to the tutorial:

```sh
cd openfl/openfl-tutorials/experimental/workflow/FederatedRuntime/HuggingFace/
```

<br/>

### 3. In the first terminal, activate experimental features and run the director:

```sh
fx experimental activate
cd director
./start_director.sh
```

<br/>

### 4. In the second, and third terminals, run the envoys:

#### 4.1 Second terminal
```sh
cd Portland
./start_envoy.sh Portland Portland_config.yaml
```

#### 4.2 Third terminal
```sh
cd Seattle
./start_envoy.sh Seattle Seattle_config.yaml
```

<br/>

### 5. Now that your director and envoy terminals are set up, run the Jupyter Notebook in your experiment terminal:

```sh
cd workspace
jupyter execute HF_FederatedRuntime.ipynb
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
settings:
director_host: localhost
director_port: 50050

Seattle:
private_attributes: private_attributes.seattle_attrs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from datasets import load_from_disk

seattle_attrs = {
"train_dataset": load_from_disk("../data/imdb_train_seattle"),
"test_dataset": load_from_disk("../data/imdb_test_seattle"),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e
ENVOY_NAME=$1
ENVOY_CONF=$2

fx envoy start -n "$ENVOY_NAME" --disable-tls -c "$ENVOY_CONF"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
settings:
listen_host: localhost
listen_port: 50050
envoy_health_check_period: 5 # in seconds
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -e

fx director start --disable-tls -c director_config.yaml
Loading
Loading