inoid commited on
Commit
b802fa4
1 Parent(s): 450e36d

Use environement variables with os.environ function

Browse files
Files changed (2) hide show
  1. app.py +1 -0
  2. spanish_medica_llm.py +7 -1
app.py CHANGED
@@ -40,6 +40,7 @@ def evaluate_model():
40
  return(f"Evaluate Model {os.environ.get('HF_LLM_MODEL_ID')} from dataset {os.environ.get('HF_LLM_DATASET_ID')}")
41
 
42
 
 
43
  def train_model(*inputs):
44
  if "IS_SHARED_UI" in os.environ:
45
  raise gr.Error("This Space only works in duplicated instances")
 
40
  return(f"Evaluate Model {os.environ.get('HF_LLM_MODEL_ID')} from dataset {os.environ.get('HF_LLM_DATASET_ID')}")
41
 
42
 
43
+
44
  def train_model(*inputs):
45
  if "IS_SHARED_UI" in os.environ:
46
  raise gr.Error("This Space only works in duplicated instances")
spanish_medica_llm.py CHANGED
@@ -518,7 +518,8 @@ def configAndRunTraining(basemodel, dataset, eval_dataset, tokenizer):
518
  save_steps = 50, # Save checkpoints every 50 steps
519
  evaluation_strategy = "steps", # Evaluate the model every logging step
520
  eval_steps = 50, # Evaluate and save checkpoints every 50 steps
521
- do_eval = True, # Perform evaluation at the end of training
 
522
  run_name=f"{run_name}-{datetime.now().strftime('%Y-%m-%d-%H-%M')}" , # Name of the W&B run (optional)
523
  fp16=True, #Set for GPU T4 for more powerful GPU as G-100 or another change to false and bf16 parameter
524
  bf16=False
@@ -534,12 +535,17 @@ def configAndRunTraining(basemodel, dataset, eval_dataset, tokenizer):
534
 
535
  basemodel.config.use_cache = False # silence the warnings. Please re-enable for inference!
536
  trainer.train()
 
 
537
  trainer.push_to_hub()
538
 
539
 
 
 
540
  def run_training_process():
541
  #Loggin to Huggin Face
542
  login(token = os.environ.get('HG_FACE_TOKEN'))
 
543
  tokenizer = loadSpanishTokenizer()
544
  medicalSpanishDataset = loadSpanishDataset()
545
  train_dataset, eval_dataset, test_dataset = splitDatasetInTestValid(
 
518
  save_steps = 50, # Save checkpoints every 50 steps
519
  evaluation_strategy = "steps", # Evaluate the model every logging step
520
  eval_steps = 50, # Evaluate and save checkpoints every 50 steps
521
+ do_eval = True, # Perform evaluation at the end of training
522
+ report_to = None, # Comment this out if you don't want to use weights & baises
523
  run_name=f"{run_name}-{datetime.now().strftime('%Y-%m-%d-%H-%M')}" , # Name of the W&B run (optional)
524
  fp16=True, #Set for GPU T4 for more powerful GPU as G-100 or another change to false and bf16 parameter
525
  bf16=False
 
535
 
536
  basemodel.config.use_cache = False # silence the warnings. Please re-enable for inference!
537
  trainer.train()
538
+
539
+
540
  trainer.push_to_hub()
541
 
542
 
543
+
544
+
545
  def run_training_process():
546
  #Loggin to Huggin Face
547
  login(token = os.environ.get('HG_FACE_TOKEN'))
548
+ os.environ['WANDB_DISABLED'] = 'true'
549
  tokenizer = loadSpanishTokenizer()
550
  medicalSpanishDataset = loadSpanishDataset()
551
  train_dataset, eval_dataset, test_dataset = splitDatasetInTestValid(