replicate / replicate-go

Go client for Replicate
https://replicate.com
Apache License 2.0
65 stars 9 forks source link

Add method for determining prediction progress from logs #13

Closed mattt closed 1 year ago

mattt commented 1 year ago

Models log progress for predictions in the format:

0%|          | 0/5 [00:00<?, ?it/s]
20%|██        | 1/5 [00:00<00:01, 21.38it/s]
40%|████▍     | 2/5 [00:01<00:01, 22.46it/s]
60%|████▍     | 3/5 [00:01<00:01, 22.46it/s]
80%|████████  | 4/5 [00:01<00:00, 22.86it/s]
100%|██████████| 5/5 [00:02<00:00, 22.26it/s]

This PR adds a Progress() method to Prediction that parses logs and returns a structured value for the last line that matches the pattern.