-
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
878fbc0
commit cc34fac
Showing
6 changed files
with
70 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
# fine-tune-llms-in-2024-with-trl | ||
|
||
## Docker setup | ||
export CUDA_VISIBLE_DEVICES=1 | ||
|
||
``` | ||
docker build -t fine-tune-llms-in-2024-with-trl:laster . | ||
docker run -it --gpus '"device=0"' --ipc=host --net=host -v $PWD:/app fine-tune-llms-in-2024-with-trl:laster /bin/bash | ||
docker run -it --gpus '"device=1"' --ipc=host --net=host -v $PWD:/app fine-tune-llms-in-2024-with-trl:laster /bin/bash | ||
``` | ||
``` | ||
|
||
|
||
modal token set --token-id ak-r6mjZ61XGQtNoCDZGHrFLP --token-secret as-2m1UyDMKKwTo2uApJVGovn | ||
|
||
export MODAL_TOKEN_ID=ak-r6mjZ61XGQtNoCDZGHrFLP | ||
export MODAL_TOKEN_SECRET=as-2m1UyDMKKwTo2uApJVGovn | ||
|
||
modal run |
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
Empty file.
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,36 +1,22 @@ | ||
import json | ||
import sys | ||
|
||
import modal | ||
import os | ||
|
||
import os | ||
import zipfile | ||
import io | ||
from modal import Image | ||
|
||
app = modal.App("example-hello-world") | ||
custom_image = Image.from_registry("ghcr.io/kyryl-opens-ml/fine-tune-llm-in-2024:main") | ||
|
||
|
||
@app.function(image=custom_image, gpu="A100") | ||
def foo(): | ||
from datasets import load_dataset | ||
import text2sql_training | ||
from text2sql_training.llm_stf import run_training | ||
|
||
@app.function(mounts=[modal.Mount.from_local_dir(".", remote_path="/app")]) | ||
def foo(a): | ||
print(a) | ||
with open('/app/test.txt', 'w') as f: | ||
f.write('TEST') | ||
print("DONE") | ||
return '/app/test.txt' | ||
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) | ||
return model_url | ||
|
||
|
||
@app.local_entrypoint() | ||
def main(): | ||
data_structure = open("requirements.txt", "r").read() | ||
result = foo.remote(data_structure) | ||
with open('test.txt', 'w') as f: | ||
f.write(result) | ||
|
||
# Define the directory where to unzip | ||
output_dir = 'unzipped_content' | ||
os.makedirs(output_dir, exist_ok=True) | ||
|
||
# Unzip the content | ||
with zipfile.ZipFile(zip_buffer, 'r') as zip_file: | ||
zip_file.extractall(path=output_dir) | ||
result = foo.remote() | ||
print(result) |