NishaDeepthi commited on
Commit
2dff7cb
·
verified ·
1 Parent(s): ae7a494

update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -3
app.py CHANGED
@@ -49,10 +49,8 @@ custom_role_conversions=None,
49
 
50
  # Import tool from Hub
51
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
52
-
53
  with open("prompts.yaml", 'r') as stream:
54
  prompt_templates = yaml.safe_load(stream)
55
-
56
  agent = CodeAgent(
57
  model=model,
58
  tools=[final_answer], ## add your tools here (don't remove final answer)
@@ -64,6 +62,44 @@ agent = CodeAgent(
64
  description=None,
65
  prompt_templates=prompt_templates
66
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
 
69
- GradioUI(agent).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  # Import tool from Hub
51
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
 
52
  with open("prompts.yaml", 'r') as stream:
53
  prompt_templates = yaml.safe_load(stream)
 
54
  agent = CodeAgent(
55
  model=model,
56
  tools=[final_answer], ## add your tools here (don't remove final answer)
 
62
  description=None,
63
  prompt_templates=prompt_templates
64
  )
65
+ GradioUI(agent).launch()
66
+
67
+
68
+ training_args = TrainingArguments(
69
+ output_dir="./lora-finetuned",
70
+ per_device_train_batch_size=4,
71
+ gradient_accumulation_steps=4,
72
+ save_steps=500,
73
+ logging_dir="./logs",
74
+ num_train_epochs=3,
75
+ save_total_limit=2,
76
+ fp16=True
77
+ )
78
+ trainer = Trainer(
79
+ model=model,
80
+ args=training_args,
81
+ train_dataset=tokenized_datasets["train"],
82
+ )
83
+ trainer.train()
84
+
85
 
86
 
87
+
88
+ training_args = TrainingArguments(
89
+ output_dir="./lora-finetuned",
90
+ per_device_train_batch_size=4,
91
+ gradient_accumulation_steps=4,
92
+ save_steps=500,
93
+ logging_dir="./logs",
94
+ num_train_epochs=3,
95
+ save_total_limit=2,
96
+ fp16=True
97
+ )
98
+
99
+ trainer=Trainer(
100
+ model=model,
101
+ args=training_args,
102
+ train_dataset=tokenized_datasets["train"],
103
+ )
104
+ trainer.train()
105
+