Skip to content

Commit

Permalink
step model bin save
Browse files Browse the repository at this point in the history
change workflow
  • Loading branch information
yezhengmao1 committed Aug 29, 2023
1 parent 562d868 commit bcd5b12
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -e .
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
flake8 . --count --show-source --statistics --max-line-length=127 --max-complexity 15
- name: Test with pytest
run: |
pytest
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4 changes: 2 additions & 2 deletions aspen/modelloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ def load_random_lora_7b_weight(model: LlamaModel,
adapter_name, "lora_B", lora_b_weight)


def save_lora_model(model: LlamaModel, config: Dict[str, str]):
def save_lora_model(model: LlamaModel, config: Dict[str, str], dir_suffix=""):
for lora_config in config["lora"]:
lora_name = lora_config["name"]
lora_output_dir = lora_config["output"]
lora_output_dir = lora_config["output"] + "_" + dir_suffix

if not os.path.exists(lora_output_dir):
os.makedirs(lora_output_dir)
Expand Down
2 changes: 1 addition & 1 deletion legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ def init_lora_model(llama_model: aspen.LlamaModel):
optimizer.step()

if step_cnt % config["save_step"] == 0:
aspen.save_lora_model(llama_model, config)
aspen.save_lora_model(llama_model, config, f"{step_cnt}")

aspen.save_lora_model(llama_model, config)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ xformers
transformers
bitsandbytes
sentencepiece
scipy

0 comments on commit bcd5b12

Please sign in to comment.