@@ -32,33 +32,58 @@ It is easy to send messages after token is issued. Just install `telepyth`
3232package by ` pip install telepyth ` , import it and notify
3333
3434``` python
35- import telepyth
35+ import telepyth
3636
37- % telepyth - t 123456789
38- % telepyth ' Very magic, wow!'
37+ % telepyth - t 123456789
38+ % telepyth ' Very magic, wow!'
3939```
4040
41+
42+ #### HuggingFace Intergration
43+
44+ TelePyth also provides a [ trainer callback] [ 1 ] for HuggingFace's
45+ ` transformers ` . There are several usage scenario. The first one is via setting
46+ reporting method in ` TrainingArguments ` .
47+
48+ ``` python
49+ import telepyth.interaction
50+ import transformers
51+
52+ args = TrainingArguments(output_dir, report_to = [' telepyth' ])
53+ ```
54+
55+ For more fine-grained control on how and when callback should report metrics,
56+ one can set up callback directly in a list of callbacks.
57+
58+ ``` python
59+ callback = TelePythCallback(label = ' finetune' , policy = ' last' )
60+ trainer = Trainer(callbacks = [callback])
61+ trainer.train()
62+ ```
63+
64+ [ 1 ] : https://huggingface.co/docs/transformers/main/en/main_classes/callback
65+
4166#### TelePyth Client
4267
4368TelepythClient allows to send notifications, figures and markdown messages
4469directly without using magics.
4570
4671``` python
47- from telepyth import TelepythClient
72+ from telepyth import TelepythClient
4873
49- tp = TelepythClient()
50- tp.send_text(' Hello, World!' ) # notify with plain text
51- tp.send_text(' _bold text_ and then *italic*' ) # or with markdown formatted text
52- tp.send_figure(some_pyplot_figure, ' Awesome caption here!' ) # or even with figure
74+ tp = TelepythClient()
75+ tp.send_text(' Hello, World!' ) # notify with plain text
76+ tp.send_text(' _bold text_ and then *italic*' ) # or with markdown formatted text
77+ tp.send_figure(some_pyplot_figure, ' Awesome caption here!' ) # or even with figure
5378```
5479
5580#### CLI
5681
5782TelePyth package also provide command line interface (CLI). It is similar to
5883IPython magic. For example, one can send notifcation as following.
5984
60- ``` bash
61- telepyth -t 31415926 " Moar notifications!"
85+ ``` shell
86+ telepyth -t 31415926 " Moar notifications!"
6287```
6388
6489#### HTTP API
@@ -68,14 +93,14 @@ wrappers and bindings. This is useful for bash scripting. Just request
6893TelePyth backend directly to notify user. For instance, to send message from
6994bash:
7095
71- ``` bash
72- curl https://daskol.xyz/api/notify/< access_token_here> \
73- -X POST \
74- -H ' Content-Type: plain/text' \
75- -d ' Hello, World!'
96+ ``` shell
97+ curl https://daskol.xyz/api/notify/< access_token_here> \
98+ -X POST \
99+ -H ' Content-Type: plain/text' \
100+ -d ' Hello, World!'
76101```
77102See more examples and usage details [ here] ( examples/ ) .
78103
79104## Credentials
80105
81- © ; [ Daniel Bershatsky] ( https://github.com/daskol ) <[ daniel.bershatsky@skolkovotech.ru ] ( mailto:daniel.berhatsky@skolkovotech.ru ) >, 2017
106+ © ; [ Daniel Bershatsky] ( https://github.com/daskol ) <[ daniel.bershatsky@skolkovotech.ru ] ( mailto:daniel.berhatsky@skolkovotech.ru ) >, 2017-2022
0 commit comments