-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc34fac
commit 118e3ec
Showing
3 changed files
with
36 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
import modal | ||
from modal import Image | ||
from datasets import load_dataset | ||
from datasets import disable_caching | ||
import pandas as pd | ||
import os | ||
|
||
app = modal.App("example-hello-world") | ||
custom_image = Image.from_registry("ghcr.io/kyryl-opens-ml/fine-tune-llm-in-2024:main") | ||
custom_image = Image.from_registry("ghcr.io/kyryl-opens-ml/fine-tune-llm-in-2024:main").env({"HF_TOKEN": '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', "HF_TOKEN_WRITE": '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'}) | ||
|
||
# ENV HF_TOKEN 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 | ||
# ENV HF_TOKEN_WRITE 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 | ||
|
||
@app.function(image=custom_image, gpu="A100") | ||
def foo(): | ||
from datasets import load_dataset | ||
import text2sql_training | ||
@app.function(image=custom_image, gpu="A100", mounts=[modal.Mount.from_local_python_packages("text2sql_training", "text2sql_training")], timeout=15 * 60) | ||
def run_training_modal(train_data_pandas: pd.DataFrame): | ||
from datasets import Dataset | ||
from text2sql_training.llm_stf import run_training | ||
|
||
train_data = load_dataset("json", data_files='train_dataset-sql.json', split="train") | ||
model_url = run_training(pretrained_model_id='meta-llama/Meta-Llama-3-8B-Instruct', peft_model_id='modal-test', train_data=train_data) | ||
model_url = run_training(pretrained_model_id='meta-llama/Meta-Llama-3-8B-Instruct', peft_model_id='modal-test', train_data=Dataset.from_pandas(train_data_pandas)) | ||
return model_url | ||
|
||
|
||
@app.local_entrypoint() | ||
def main(): | ||
result = foo.remote() | ||
train_data = load_dataset("json", data_files='train_dataset-sql.json', split="train") | ||
result = run_training_modal.remote(train_data_pandas=train_data.to_pandas()) | ||
print(result) |