File tree Expand file tree Collapse file tree 4 files changed +30
-0
lines changed Expand file tree Collapse file tree 4 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -515,6 +515,8 @@ soft overlong 奖励参数
515
515
- swanlab_project: swanlab的project,需要在页面中预先创建好:[ https://swanlab.cn/space/ ~ ] ( https://swanlab.cn/space/~ ) 。
516
516
- swanlab_workspace: 默认为None,会使用api-key对应的username。
517
517
- swanlab_exp_name: 实验名,可以为空,为空时默认传入--output_dir的值。
518
+ - swanlab_lark_webhook_url: 默认为None。swanlab的lark webhook url,用于推送实验结果到飞书。
519
+ - swanlab_lark_secret: 默认为None。swanlab的lark secret,用于推送实验结果到飞书。
518
520
- swanlab_mode: 可选cloud和local,云模式或者本地模式。
519
521
520
522
### 推理参数
Original file line number Diff line number Diff line change @@ -535,6 +535,8 @@ Soft overlong reward parameters:
535
535
- ** swanlab_project** : SwanLab's project, which needs to be created in advance on the page: [ https://swanlab.cn/space/ ~ ] ( https://swanlab.cn/space/~ )
536
536
- ** swanlab_workspace** : Defaults to ` None ` , will use the username associated with the API key
537
537
- ** swanlab_exp_name** : Experiment name, can be left empty. If empty, the value of ` --output_dir ` will be used by default
538
+ - swanlab_lark_webhook_url: Defaults to None. SwanLab's Lark webhook URL, used for pushing experiment results to Lark.
539
+ - swanlab_lark_secret: Defaults to None. SwanLab's Lark secret, used for pushing experiment results to Lark.
538
540
- ** swanlab_mode** : Optional values are ` cloud ` and ` local ` , representing cloud mode or local mode
539
541
540
542
Original file line number Diff line number Diff line change @@ -68,6 +68,8 @@ class SwanlabArguments:
68
68
swanlab_project : Optional [str ] = None
69
69
swanlab_workspace : Optional [str ] = None
70
70
swanlab_exp_name : Optional [str ] = None
71
+ swanlab_lark_webhook_url : Optional [str ] = None
72
+ swanlab_lark_secret : Optional [str ] = None
71
73
swanlab_mode : Literal ['cloud' , 'local' ] = 'cloud'
72
74
73
75
def _init_swanlab (self ):
@@ -80,6 +82,15 @@ def _init_swanlab(self):
80
82
from swanlab .integration .transformers import SwanLabCallback
81
83
if self .swanlab_token :
82
84
swanlab .login (self .swanlab_token )
85
+
86
+ if self .swanlab_lark_webhook_url is not None :
87
+ from swanlab .plugin .notification import LarkCallback
88
+ lark_callback = LarkCallback (
89
+ webhook_url = self .swanlab_lark_webhook_url ,
90
+ secret = self .swanlab_lark_secret ,
91
+ )
92
+ swanlab .register_callbacks ([lark_callback ])
93
+
83
94
INTEGRATION_TO_CALLBACK ['swanlab' ] = SwanLabCallback (
84
95
project = self .swanlab_project ,
85
96
workspace = self .swanlab_workspace ,
Original file line number Diff line number Diff line change @@ -47,6 +47,18 @@ class ReportTo(BaseUI):
47
47
'en' : 'Experiment of SwanLab'
48
48
},
49
49
},
50
+ 'swanlab_lark_webhook_url' : {
51
+ 'label' : {
52
+ 'zh' : 'SwanLab飞书Webhook地址' ,
53
+ 'en' : 'Webhook URL of SwanLab Lark Callback'
54
+ },
55
+ },
56
+ 'swanlab_lark_secret' : {
57
+ 'label' : {
58
+ 'zh' : 'SwanLab飞书Secret' ,
59
+ 'en' : 'Secret of SwanLab Lark Callback'
60
+ },
61
+ },
50
62
'swanlab_mode' : {
51
63
'label' : {
52
64
'zh' : 'SwanLab工作模式' ,
@@ -69,6 +81,9 @@ def do_build_ui(cls, base_tab: Type['BaseUI']):
69
81
scale = 20 )
70
82
gr .Textbox (elem_id = 'swanlab_token' , lines = 1 , scale = 20 )
71
83
gr .Textbox (elem_id = 'swanlab_project' , lines = 1 , scale = 20 )
84
+ with gr .Row ():
85
+ gr .Textbox (elem_id = 'swanlab_lark_webhook_url' , lines = 1 , scale = 20 )
86
+ gr .Textbox (elem_id = 'swanlab_lark_secret' , lines = 1 , scale = 20 )
72
87
with gr .Row ():
73
88
gr .Textbox (elem_id = 'swanlab_workspace' , lines = 1 , scale = 20 )
74
89
gr .Textbox (elem_id = 'swanlab_exp_name' , lines = 1 , scale = 20 )
You can’t perform that action at this time.
0 commit comments