Spaces:
Runtime error
Runtime error
menouar
commited on
Commit
·
67a37c0
1
Parent(s):
0e9e537
Improve comments
Browse files- utils/components_creator.py +1 -1
- utils/notebook_generator.py +13 -5
utils/components_creator.py
CHANGED
|
@@ -126,7 +126,7 @@ def add_training_args_1_bis() -> Set[Component]:
|
|
| 126 |
logging_steps = gr.Slider(1, 100, step=1, value=10, label="logging_steps",
|
| 127 |
info="Number of update steps between two logs if logging_strategy='steps'",
|
| 128 |
interactive=True, elem_id=LOGGING_STEPS_ID)
|
| 129 |
-
per_device_train_batch_size = gr.Slider(1, 64, step=1, value=
|
| 130 |
info="Batch size per device during training.",
|
| 131 |
interactive=True, elem_id=PER_DEVICE_TRAIN_BATCH_SIZE)
|
| 132 |
save_strategy = gr.Radio(['no', 'epoch', 'steps'], label="save_strategy",
|
|
|
|
| 126 |
logging_steps = gr.Slider(1, 100, step=1, value=10, label="logging_steps",
|
| 127 |
info="Number of update steps between two logs if logging_strategy='steps'",
|
| 128 |
interactive=True, elem_id=LOGGING_STEPS_ID)
|
| 129 |
+
per_device_train_batch_size = gr.Slider(1, 64, step=1, value=3, label="per_device_train_batch_size",
|
| 130 |
info="Batch size per device during training.",
|
| 131 |
interactive=True, elem_id=PER_DEVICE_TRAIN_BATCH_SIZE)
|
| 132 |
save_strategy = gr.Radio(['no', 'epoch', 'steps'], label="save_strategy",
|
utils/notebook_generator.py
CHANGED
|
@@ -61,10 +61,18 @@ def create_login_hf_cells(cells: list, should_login: bool = False, model_name: O
|
|
| 61 |
text_cell = nbf.v4.new_markdown_cell(
|
| 62 |
"## Login to HF")
|
| 63 |
|
| 64 |
-
text_1 = "
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
if should_login:
|
| 67 |
-
text_1 = f"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
text_cell1 = nbf.v4.new_markdown_cell(text_1)
|
| 70 |
code = """
|
|
@@ -87,7 +95,7 @@ login(
|
|
| 87 |
def create_datasets_cells(cells: list, dataset: FTDataSet, seed: int):
|
| 88 |
text_cell = nbf.v4.new_markdown_cell("# Load and Prepare the Dataset")
|
| 89 |
text = 'The dataset is already formatted in a conversational format, which is supported by [trl](' \
|
| 90 |
-
'https://huggingface.co/docs/trl/index/).
|
| 91 |
text_format = """
|
| 92 |
**Conversational format:**
|
| 93 |
|
|
@@ -236,7 +244,7 @@ peft_config = LoraConfig(
|
|
| 236 |
text = """The `SFTTrainer` provides native integration with `peft`, simplifying the process of efficiently tuning
|
| 237 |
Language Models (LLMs) using techniques such as [LoRA](
|
| 238 |
https://magazine.sebastianraschka.com/p/practical-tips-for-finetuning-llms). The only requirement is to create
|
| 239 |
-
|
| 240 |
"""
|
| 241 |
|
| 242 |
code_cell = nbf.v4.new_code_cell(code)
|
|
@@ -433,7 +441,7 @@ for item in os.listdir(source_folder):
|
|
| 433 |
|
| 434 |
|
| 435 |
def push_to_hub_cells(cells: list, output_dir):
|
| 436 |
-
text = f"## Pushing '{output_dir}' to
|
| 437 |
code = f"""
|
| 438 |
from huggingface_hub import HfApi, HfFolder, Repository
|
| 439 |
|
|
|
|
| 61 |
text_cell = nbf.v4.new_markdown_cell(
|
| 62 |
"## Login to HF")
|
| 63 |
|
| 64 |
+
text_1 = """
|
| 65 |
+
Login with `HF_TOKEN` in order to push the fine-tuned model to `huggingface_hub`.
|
| 66 |
+
|
| 67 |
+
Replace `HF_TOKEN` with a valid Token.
|
| 68 |
+
"""
|
| 69 |
|
| 70 |
if should_login:
|
| 71 |
+
text_1 = f"""
|
| 72 |
+
Login with `HF_TOKEN` in order to load **{model_name}** from `huggingface_hub`.
|
| 73 |
+
|
| 74 |
+
Replace `HF_TOKEN` with a valid Token.
|
| 75 |
+
"""
|
| 76 |
|
| 77 |
text_cell1 = nbf.v4.new_markdown_cell(text_1)
|
| 78 |
code = """
|
|
|
|
| 95 |
def create_datasets_cells(cells: list, dataset: FTDataSet, seed: int):
|
| 96 |
text_cell = nbf.v4.new_markdown_cell("# Load and Prepare the Dataset")
|
| 97 |
text = 'The dataset is already formatted in a conversational format, which is supported by [trl](' \
|
| 98 |
+
'https://huggingface.co/docs/trl/index/), and ready for supervised finetuning.'
|
| 99 |
text_format = """
|
| 100 |
**Conversational format:**
|
| 101 |
|
|
|
|
| 244 |
text = """The `SFTTrainer` provides native integration with `peft`, simplifying the process of efficiently tuning
|
| 245 |
Language Models (LLMs) using techniques such as [LoRA](
|
| 246 |
https://magazine.sebastianraschka.com/p/practical-tips-for-finetuning-llms). The only requirement is to create
|
| 247 |
+
the `LoraConfig` and pass it to the `SFTTrainer`.
|
| 248 |
"""
|
| 249 |
|
| 250 |
code_cell = nbf.v4.new_code_cell(code)
|
|
|
|
| 441 |
|
| 442 |
|
| 443 |
def push_to_hub_cells(cells: list, output_dir):
|
| 444 |
+
text = f"## Pushing '{output_dir}' to the Hugging Face account."
|
| 445 |
code = f"""
|
| 446 |
from huggingface_hub import HfApi, HfFolder, Repository
|
| 447 |
|