-
Notifications
You must be signed in to change notification settings - Fork 223
[NVFlare Summer of Code] Adding FedOBD (IJCAI 2023) to the research dir #3666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: cyy <[email protected]>
ZiyueXu77
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall good, minor fixes
| @@ -0,0 +1,4 @@ | |||
| nvflare~=2.5.0rc | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.5 won't work, we can remove the version number
Greptile OverviewGreptile SummaryAdds FedOBD (IJCAI 2023) research implementation to the research directory, including documentation and requirements. The ADAQUANT quantization scheme implementation already exists in Key changes:
Issues found:
Confidence Score: 3/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant Repo as Repository
participant Research as research/
participant FedOBD as research/fedobd/
participant Quantizer as nvflare/app_opt/pt/quantization/
Dev->>Research: Add FedOBD to research list
Dev->>FedOBD: Create README.md
Dev->>FedOBD: Create requirements.txt
Note over FedOBD: References ADAQUANT implementation
FedOBD-->>Quantizer: Uses ada_quant.py
Note over Quantizer: ADAQUANT already implemented<br/>in nvflare codebase
Dev->>Repo: Update research/README.md
Note over Repo: Renumber all entries 01-10
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, 3 comments
Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format
|
|
||
| ## Steps to run the code | ||
|
|
||
| Let's follow the steps in the [quantization examples] (https://github.com/NVIDIA/NVFlare/tree/main/examples/advanced/llm_hf). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: markdown link has space before URL which breaks the link
| Let's follow the steps in the [quantization examples] (https://github.com/NVIDIA/NVFlare/tree/main/examples/advanced/llm_hf). | |
| Let's follow the steps in the [quantization examples](https://github.com/NVIDIA/NVFlare/tree/main/examples/advanced/llm_hf). |
| ### Data Preparation | ||
| cd examples/advanced/llm_hf | ||
|
|
||
| mkdir dataset | ||
| cd dataset | ||
| git clone https://huggingface.co/datasets/tatsu-lab/alpaca | ||
| git clone https://huggingface.co/datasets/databricks/databricks-dolly-15k | ||
| git clone https://huggingface.co/datasets/OpenAssistant/oasst1 | ||
| cd .. | ||
| mkdir dataset/dolly | ||
| python ./utils/preprocess_dolly.py --training_file dataset/databricks-dolly-15k/databricks-dolly-15k.jsonl --output_dir dataset/dolly | ||
| python ./utils/preprocess_alpaca.py --training_file dataset/alpaca/data/train-00000-of-00001-a09b74b3ef9c3b56.parquet --output_dir dataset/alpaca | ||
| python ./utils/preprocess_oasst1.py --training_file dataset/oasst1/data/train-00000-of-00001-b42a775f407cee45.parquet --validation_file dataset/oasst1/data/validation-00000-of-00001-134b8fd0c89408b6.parquet --output_dir dataset/oasst1 | ||
|
|
||
| ### Run ADAQUANT | ||
|
|
||
| python3 llm_hf_fl_job.py --client_ids dolly --data_path ${PWD}/dataset --workspace_dir ${PWD}/workspace/hf_sft_adaquant --job_dir ${PWD}/workspace/jobs/hf_sft_adaquant --train_mode SFT --quantize_mode adaquant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: bash commands not wrapped in code block - should use ```bash fencing for proper formatting
| ### Data Preparation | |
| cd examples/advanced/llm_hf | |
| mkdir dataset | |
| cd dataset | |
| git clone https://huggingface.co/datasets/tatsu-lab/alpaca | |
| git clone https://huggingface.co/datasets/databricks/databricks-dolly-15k | |
| git clone https://huggingface.co/datasets/OpenAssistant/oasst1 | |
| cd .. | |
| mkdir dataset/dolly | |
| python ./utils/preprocess_dolly.py --training_file dataset/databricks-dolly-15k/databricks-dolly-15k.jsonl --output_dir dataset/dolly | |
| python ./utils/preprocess_alpaca.py --training_file dataset/alpaca/data/train-00000-of-00001-a09b74b3ef9c3b56.parquet --output_dir dataset/alpaca | |
| python ./utils/preprocess_oasst1.py --training_file dataset/oasst1/data/train-00000-of-00001-b42a775f407cee45.parquet --validation_file dataset/oasst1/data/validation-00000-of-00001-134b8fd0c89408b6.parquet --output_dir dataset/oasst1 | |
| ### Run ADAQUANT | |
| python3 llm_hf_fl_job.py --client_ids dolly --data_path ${PWD}/dataset --workspace_dir ${PWD}/workspace/hf_sft_adaquant --job_dir ${PWD}/workspace/jobs/hf_sft_adaquant --train_mode SFT --quantize_mode adaquant | |
| ### Data Preparation | |
| ```bash | |
| cd examples/advanced/llm_hf | |
| mkdir dataset | |
| cd dataset | |
| git clone https://huggingface.co/datasets/tatsu-lab/alpaca | |
| git clone https://huggingface.co/datasets/databricks/databricks-dolly-15k | |
| git clone https://huggingface.co/datasets/OpenAssistant/oasst1 | |
| cd .. | |
| mkdir dataset/dolly | |
| python ./utils/preprocess_dolly.py --training_file dataset/databricks-dolly-15k/databricks-dolly-15k.jsonl --output_dir dataset/dolly | |
| python ./utils/preprocess_alpaca.py --training_file dataset/alpaca/data/train-00000-of-00001-a09b74b3ef9c3b56.parquet --output_dir dataset/alpaca | |
| python ./utils/preprocess_oasst1.py --training_file dataset/oasst1/data/train-00000-of-00001-b42a775f407cee45.parquet --validation_file dataset/oasst1/data/validation-00000-of-00001-134b8fd0c89408b6.parquet --output_dir dataset/oasst1 |
Run ADAQUANT
python3 llm_hf_fl_job.py --client_ids dolly --data_path ${PWD}/dataset --workspace_dir ${PWD}/workspace/hf_sft_adaquant --job_dir ${PWD}/workspace/jobs/hf_sft_adaquant --train_mode SFT --quantize_mode adaquant|
|
||
| ## Implementation | ||
|
|
||
| A quantization scheme called "ADAQUANT" has been added to NVFLARE under **nvflare/app_opt/pt/quantization**, which is based on our [official implementation](https://github.com/cyyever/distributed_learning_simulator). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: README claims ADAQUANT quantization scheme was added to nvflare/app_opt/pt/quantization, but that directory only contains generic quantization code with no "adaquant" mode. The quantizer only supports FLOAT16, BLOCKWISE8, FLOAT4, and NORMFLOAT4. Either the implementation is missing or the claim is inaccurate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, 1 comment
|
|
||
| ### Run ADAQUANT | ||
|
|
||
| python3 llm_hf_fl_job.py --client_ids dolly --data_path ${PWD}/dataset --workspace_dir ${PWD}/workspace/hf_sft_adaquant --job_dir ${PWD}/workspace/jobs/hf_sft_adaquant --train_mode SFT --quantize_mode adaquant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: incorrect script name - should be job.py not llm_hf_fl_job.py
| python3 llm_hf_fl_job.py --client_ids dolly --data_path ${PWD}/dataset --workspace_dir ${PWD}/workspace/hf_sft_adaquant --job_dir ${PWD}/workspace/jobs/hf_sft_adaquant --train_mode SFT --quantize_mode adaquant | |
| python3 job.py --client_ids dolly --data_path ${PWD}/dataset --workspace_dir ${PWD}/workspace/hf_sft_adaquant --job_dir ${PWD}/workspace/jobs/hf_sft_adaquant --train_mode SFT --quantize_mode adaquant |
Description
Add the FedOBD to research. Experiment results will be added ASAP.
Types of changes
./runtest.sh.