mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2026-08-17 21:45:48 +08:00
[webui] add seed controls for reproducibility (#10629)
Co-authored-by: Karunanidhi Mishra <11963379+kmishra1204@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a61cfa692a
commit
5987a8dd68
@@ -51,6 +51,13 @@ if TYPE_CHECKING:
|
||||
from .manager import Manager
|
||||
|
||||
|
||||
def _parse_seed(value: Any, default: int = 42) -> int:
|
||||
try:
|
||||
return int(value)
|
||||
except (TypeError, ValueError):
|
||||
return default
|
||||
|
||||
|
||||
class Runner:
|
||||
r"""A class to manage the running status of the trainers."""
|
||||
|
||||
@@ -147,6 +154,7 @@ class Runner:
|
||||
learning_rate=float(get("train.learning_rate")),
|
||||
num_train_epochs=float(get("train.num_train_epochs")),
|
||||
max_samples=int(get("train.max_samples")),
|
||||
seed=_parse_seed(get("train.train_seed")),
|
||||
per_device_train_batch_size=get("train.batch_size"),
|
||||
gradient_accumulation_steps=get("train.gradient_accumulation_steps"),
|
||||
lr_scheduler_type=get("train.lr_scheduler_type"),
|
||||
@@ -316,6 +324,7 @@ class Runner:
|
||||
max_new_tokens=get("eval.max_new_tokens"),
|
||||
top_p=get("eval.top_p"),
|
||||
temperature=get("eval.temperature"),
|
||||
seed=_parse_seed(get("eval.eval_seed")),
|
||||
output_dir=get_save_dir(model_name, finetuning_type, get("eval.output_dir")),
|
||||
trust_remote_code=True,
|
||||
ddp_timeout=180000000,
|
||||
|
||||
Reference in New Issue
Block a user