-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add finetuner docs #771
Conversation
Codecov Report
@@ Coverage Diff @@
## main #771 +/- ##
==========================================
- Coverage 82.09% 81.85% -0.25%
==========================================
Files 17 17
Lines 1240 1251 +11
==========================================
+ Hits 1018 1024 +6
- Misses 222 227 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EMPTY?
docs failing. possible reason: ryanfox/sphinx-markdown-tables#36 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Left some general comments.
I will fix this issue in main since it breaks our doc building, please rebase your PR then. |
i guess we need to tweak the words a bit, I'll invite @violenil to take a look |
docs/user-guides/finetuner.md
Outdated
@@ -0,0 +1,186 @@ | |||
# Fine-tune Models | |||
|
|||
Although CLIP-as-service has provided you a list of pre-trained models, you can also train your models. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can also fine-tune your models.
epochs=5, | ||
learning_rate=1e-5, | ||
loss='CLIPLoss', | ||
cpu=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bwanglzu Just want to confirm will cpu=False
work defaultly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by default, finetuner use cpu
, if you want to use gpu
, you have to set cpu=False
. @numb3r3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me clarify my question. What I really want to ask is "Does finetuner currently allows training a model on GPU for free"?
docs/user-guides/finetuner.md
Outdated
``` | ||
|
||
The full dataset has been converted to `clip-fashion-train-data` and `clip-fashion-eval-data` and pushed to the cloud. | ||
You can directly use them in Finetuner. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can directly use them in Finetuner.
You can directly use them by providing the dataset name in
docs/user-guides/finetuner.md
Outdated
train_da.push('fashion-sample') | ||
``` | ||
|
||
The full dataset has been converted to `clip-fashion-train-data` and `clip-fashion-eval-data` and pushed to the cloud. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which can ...
run = finetuner.fit( | ||
model='openai/clip-vit-base-patch32', | ||
run_name='clip-fashion', | ||
train_data='clip-fashion-train-data', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bwanglzu will finetuner accept docarray instance (rather than a name in hubble) as the dataset input?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, both are supported! it can be a string of docarray name, or a document array python instance @numb3r3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettry cool
docs/user-guides/finetuner.md
Outdated
You can push the resulting [`DocumentArray`](https://docarray.jina.ai/fundamentals/documentarray/) to the cloud using the [`.push`](https://docarray.jina.ai/api/docarray.array.document/?highlight=push#docarray.array.document.DocumentArray.push) method. | ||
|
||
We use [fashion captioning dataset](https://github.com/xuewyang/Fashion_Captioning) as a sample dataset in this tutorial. | ||
You can get the description and image url from the dataset: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get the description and image url from the dataset: | |
The following are examples of descriptions and image urls from the dataset: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can show the user how they can view these descriptions + urls themselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I can, but i think this will distract users and it is not the main topic of this tutorial
docs/user-guides/finetuner.md
Outdated
|
||
Since the tuned model generated from Finetuner contains richer information such as metadata and config, we now transform it to simpler structure used by CLIP-as-service. | ||
|
||
* First create a new folder named `clip-fashion-cas` or anything you like. This will be the storage of the models to use in CLIP-as-service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* First create a new folder named `clip-fashion-cas` or anything you like. This will be the storage of the models to use in CLIP-as-service. | |
* Firstly, create a new folder named `clip-fashion-cas` or name of your choice. This will be the storage of the models to use in CLIP-as-service. |
docs/user-guides/finetuner.md
Outdated
|
||
* Second copy and move `clip-fashion/models/clip-text/model.onnx` to `clip-fashion-cas` and rename it to `textual.onnx`. | ||
|
||
* Similarly, copy and move `clip-fashion/models/clip-vision/model.onnx` to `clip-fashion-cas` and rename it to `visual.onnx`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Similarly, copy and move `clip-fashion/models/clip-vision/model.onnx` to `clip-fashion-cas` and rename it to `visual.onnx`. | |
* Similarly, copy the vision model `clip-fashion/models/clip-vision/model.onnx` into `clip-fashion-cas` and rename the model to `visual.onnx`. |
Co-authored-by: Isabelle Mohr <[email protected]>
Co-authored-by: Isabelle Mohr <[email protected]>
Co-authored-by: Isabelle Mohr <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -80,6 +80,8 @@ | |||
html_show_sourcelink = False | |||
html_favicon = '_static/favicon.png' | |||
|
|||
intersphinx_mapping = {'docarray': ('https://docarray.jina.ai/', None), 'finetuner': ('https://finetuner.jina.ai/', None)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect, good catch
docs/user-guides/finetuner.md
Outdated
|
||
| Description | Image URL | | ||
|---------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| subtly futuristic and edgy this liquid metal cuff bracelet is shaped from sculptural rectangular link | [https://n.nordstrommedia.com/id/sr3/<br/>58d1a13f-b6b6-4e68-b2ff-3a3af47c422e.jpeg](https://n.nordstrommedia.com/id/sr3/58d1a13f-b6b6-4e68-b2ff-3a3af47c422e.jpeg) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we display the image, rather than simply print URL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copyright?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also kept the original image urls since it is from the dataset
run = finetuner.fit( | ||
model='openai/clip-vit-base-patch32', | ||
run_name='clip-fashion', | ||
train_data='clip-fashion-train-data', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettry cool
epochs=5, | ||
learning_rate=1e-5, | ||
loss='CLIPLoss', | ||
cpu=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me clarify my question. What I really want to ask is "Does finetuner currently allows training a model on GPU for free"?
📝 Docs are deployed on https://ft-finetuner-docs--jina-docs.netlify.app 🎉 |
This pr adds instructions on how to use fine-tuned model in clip-server trained by finetuner.
The doc is currently under user-guides. Will decide a more appropriate place later