Skip to content

Commit 4edfdc2

Browse files
authored
Add Lightning Studios to cloud partners and OpenCompass to ecosystem (pytorch#1843)
* Add OpenCompass to ecosystem Signed-off-by: Chris Abraham <[email protected]> * Add Lightning Studios to Cloud Partners Signed-off-by: Chris Abraham <[email protected]> * update Signed-off-by: Chris Abraham <[email protected]> * Added blog post "docTR joins PyTorch Ecosystem: From Pixels to Data, Building a Recognition Pipeline with PyTorch and docTR" Signed-off-by: Chris Abraham <[email protected]> * tweaks Signed-off-by: Chris Abraham <[email protected]> * fix Signed-off-by: Chris Abraham <[email protected]> * fix Signed-off-by: Chris Abraham <[email protected]> * fix Signed-off-by: Chris Abraham <[email protected]> * fixes Signed-off-by: Chris Abraham <[email protected]> * back out Signed-off-by: Chris Abraham <[email protected]> * fix Signed-off-by: Chris Abraham <[email protected]> * fix Signed-off-by: Chris Abraham <[email protected]> --------- Signed-off-by: Chris Abraham <[email protected]>
1 parent 73bc75a commit 4edfdc2

16 files changed

+240
-2
lines changed

_ecosystem/opencompass

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
layout: ecosystem_detail
3+
title: OpenCompass
4+
summary: OpenCompass is an LLM evaluation platform, supporting a wide range of models (Llama3, Mistral, InternLM2,GPT-4,LLaMa2, Qwen,GLM, Claude, etc) over 100+ datasets.
5+
link: https://opencompass.org.cn/
6+
summary-home: OpenCompass is an LLM evaluation platform, supporting a wide range of models (Llama3, Mistral, InternLM2,GPT-4,LLaMa2, Qwen,GLM, Claude, etc) over 100+ datasets.
7+
featured-home: false
8+
github-id: open-compass/opencompass
9+
date-added: 12/18/24
10+
---

_get_started/get-started-via-cloud-partners.md

+4
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ get-started-via-cloud: true
3232
{% include_relative installation/google-cloud.md %}
3333
{% endcapture %}
3434

35+
{% capture lightning-studios %}
36+
{% include_relative installation/lightning-studios.md %}
37+
{% endcapture %}
3538

3639
<div id="cloud">
3740
<div class="platform aws">{{aws | markdownify }}</div>
3841
<div class="platform google-cloud">{{google-cloud | markdownify }}</div>
3942
<div class="platform microsoft-azure">{{azure | markdownify }}</div>
43+
<div class="platform lightning-studios">{{lightning-studios | markdownify }}</div>
4044
</div>
4145

4246
<script page-id="get-started-via-cloud-partners" src="{{ site.baseurl }}/assets/menu-tab-selection.js"></script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Using PyTorch with Lightning Studios
2+
{:.no_toc}
3+
4+
Lightning Studios let you fully experience PyTorch and its ecosystem on accelerated compute in seconds. You can pick a GPU and customize from your browser or any local IDE with zero setup.
5+
6+
**Lightning Studios provide:**
7+
8+
* ready-to-use environments that come with PyTorch and PyTorch Lightning pre-installed
9+
* accelerated computing on GPUs such as L4, L40S, and H100, and the ability to switch between them in seconds
10+
* optimized multi-node training, to scale up PyTorch training jobs across machines
11+
12+
Lightning Studios enable you to share fully reproducible environments preloaded with everything you need to build AI systems, like data processing, pretraining, finetuning, inference, etc. Our library of 2K community-built, open sourced templates have pre-installed dependencies, model weights, data, code and more.
13+
14+
## Getting Started
15+
{: #ls-getting-started}
16+
17+
18+
* Go to [lightning.ai](http://lightning.ai/)
19+
* Sign up (you get 22 free GPU hours monthly)
20+
* Start up your first Studio
21+
* Or duplicate one of our templates at [lightning.ai/studios](http://lightning.ai/studios)
22+
23+
**With Studios, you can:**
24+
25+
* Pay-as-you-go
26+
* Get GPUs from $0.40 p/h
27+
* Use your own AWS credits
28+
* Access 24/7 Enterprise support
29+
30+
## Build AI, not infrastructure
31+
{: #ls-build}
32+
33+
With Lightning Studios, you can easily build AI products with full and low code tools in one place, plus access GPUs, train models and deploy.
34+
35+
AI products like Stable Diffusion and NVIDIA’s NeMo are built with Lightning. Whether you're experimenting with your first model, AI app, or deploying AI at enterprise scale. Lightning powers every stage — even pretraining LLMs on 10,000+ GPUs.

_includes/quick-start-module.js

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var supportedCloudPlatforms = [
2727
'aws',
2828
'google-cloud',
2929
'microsoft-azure',
30+
'lightning-studios',
3031
];
3132

3233
var os = $(".os > .option");

_includes/quick_start_cloud_options.html

+11
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,15 @@
4444
</ul>
4545
</div>
4646
</div>
47+
48+
<div class="cloud-option-row">
49+
<div class="cloud-option" data-toggle="cloud-dropdown">
50+
<div class="cloud-option-body lightning-studios" id="lightning-studios">
51+
Lightning Studios
52+
</div>
53+
<ul>
54+
<li><a href="https://lightning.ai/">lightning.ai</a></li>
55+
</ul>
56+
</div>
57+
</div>
4758
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
---
2+
layout: blog_detail
3+
title: "docTR joins PyTorch Ecosystem: From Pixels to Data, Building a Recognition Pipeline with PyTorch and docTR"
4+
author: Olivier Dulcy & Sebastian Olivera, Mindee
5+
---
6+
7+
![docTR logo](/assets/images/doctr-joins-pytorch-ecosystem/fg1.png){:style="width:100%;display: block;max-width:400px; margin-left:auto; margin-right:auto;"}
8+
9+
We’re thrilled to announce that the docTR project has been integrated into the PyTorch ecosystem! This integration ensures that docTR aligns with PyTorch’s standards and practices, giving developers a reliable, community-backed solution for powerful OCR workflows.
10+
11+
**For more information on what it means to be a PyTorch ecosystem project, see the [PyTorch Ecosystem Tools page](https://pytorch.org/ecosystem/).**
12+
13+
14+
## About docTR
15+
16+
docTR is an Apache 2.0 project developed and distributed by [Mindee](https://www.mindee.com/) to help developers integrate OCR capabilities into applications with no prior knowledge required.
17+
18+
To quickly and efficiently extract text information, docTR uses a two-stage approach:
19+
20+
21+
22+
* First, it performs text **detection** to localize words.
23+
* Then, it conducts text **recognition** to identify all characters in a word.
24+
25+
**Detection** and **recognition** are performed by state-of-the-art models written in PyTorch. To learn more about this approach, you can refer [to the docTR documentation](https://mindee.github.io/doctr/using_doctr/using_models.html).
26+
27+
docTR enhances the user experience in PyTorch projects by providing high-performance OCR capabilities right out of the box. Its specially designed models require minimal to no fine-tuning for common use cases, allowing developers to quickly integrate advanced document analysis features.
28+
29+
30+
## Local installation
31+
32+
docTR requires Python >= 3.10 and supports Windows, Mac and Linux. Please refer to our [README](https://github.com/mindee/doctr?tab=readme-ov-file#installation) for necessary dependencies for MacBook with the M1 chip.
33+
34+
```
35+
pip3 install -U pip
36+
pip3 install "python-doctr[torch,viz]"
37+
```
38+
39+
This will install docTR along with the latest version of PyTorch.
40+
41+
42+
```
43+
Note: docTR also provides docker images for an easy deployment, such as a part of Kubernetes cluster.
44+
```
45+
46+
47+
48+
## Text recognition
49+
50+
Now, let’s try docTR’s OCR recognition on this sample:
51+
52+
53+
![OCR sample](/assets/images/doctr-joins-pytorch-ecosystem/fg2.jpg){:style="width:100%;display: block;max-width:300px; margin-left:auto; margin-right:auto;"}
54+
55+
56+
The OCR recognition model expects an image with only one word on it and will output the predicted word with a confidence score. You can use the following snippet to test OCR capabilities from docTR:
57+
58+
```
59+
python
60+
from doctr.io import DocumentFile
61+
from doctr.models import recognition_predictor
62+
63+
doc = DocumentFile.from_images("/path/to/image")
64+
65+
# Load the OCR model
66+
# This will download pre-trained models hosted by Mindee
67+
model = recognition_predictor(pretrained=True)
68+
69+
result = model(doc)
70+
print(result)
71+
```
72+
73+
Here, the most important line of code is `model = recognition_predictor(pretrained=True)`. This will load a default text recognition model, `crnn_vgg16_bn`, but you can select other models through the `arch` parameter. You can check out the [available architectures](https://mindee.github.io/doctr/using_doctr/using_models.html).
74+
75+
When run on the sample, the recognition predictor retrieves the following data: `[('MAGAZINE', 0.9872216582298279)]`
76+
77+
78+
```
79+
Note: using the DocumentFile object docTR provides an easy way to manipulate PDF or Images.
80+
```
81+
82+
83+
84+
## Text detection
85+
86+
The last example was a crop on a single word. Now, what about an image with several words on it, like this one?
87+
88+
89+
![photo of magazines](/assets/images/doctr-joins-pytorch-ecosystem/fg3.jpg){:style="width:100%;display: block;max-width:300px; margin-left:auto; margin-right:auto;"}
90+
91+
92+
A text detection model is used before the text recognition to output a segmentation map representing the location of the text. Following that, the text recognition is applied on every detected patch.
93+
94+
Below is a snippet to run only the detection part:
95+
96+
```
97+
from doctr.io import DocumentFile
98+
from doctr.models import detection_predictor
99+
from matplotlib import pyplot as plt
100+
from doctr.utils.geometry import detach_scores
101+
from doctr.utils.visualization import draw_boxes
102+
103+
doc = DocumentFile.from_images("path/to/my/file")
104+
model = detection_predictor(pretrained=True)
105+
106+
result = model(doc)
107+
108+
draw_boxes(detach_scores([result[0]["words"]])[0][0], doc[0])
109+
plt.axis('off')
110+
plt.show()
111+
```
112+
113+
Running it on the full sample yields the following:
114+
115+
116+
![photo of magazines](/assets/images/doctr-joins-pytorch-ecosystem/fg4.png){:style="width:100%;display: block;max-width:300px; margin-left:auto; margin-right:auto;"}
117+
118+
119+
Similarly to the text recognition, `detection_predictor` will load a default model (`fast_base` here). You can also load another one by providing it through the `arch` parameter.
120+
121+
122+
## The full implementation
123+
124+
Now, let’s plug both components into the same pipeline.
125+
126+
Conveniently, docTR provides a wrapper that does exactly that for us:
127+
128+
```
129+
from doctr.io import DocumentFile
130+
from doctr.models import ocr_predictor
131+
132+
doc = DocumentFile.from_images("/path/to/image")
133+
134+
model = ocr_predictor(pretrained=True, assume_straight_pages=False)
135+
136+
result = model(doc)
137+
result.show()
138+
```
139+
140+
![photo of magazines](/assets/images/doctr-joins-pytorch-ecosystem/fg5.png){:style="width:100%;display: block;max-width:300px; margin-left:auto; margin-right:auto;"}
141+
142+
The last line should display a matplotlib window which shows the detected patches. Hovering the mouse over them will display their contents.
143+
144+
You can also do more with this output, such as reconstituting a synthetic document like so:
145+
146+
```
147+
import matplotlib.pyplot as plt
148+
149+
synthetic_pages = result.synthesize()
150+
plt.imshow(synthetic_pages[0])
151+
plt.axis('off')
152+
plt.show()
153+
```
154+
155+
![black text on white](/assets/images/doctr-joins-pytorch-ecosystem/fg6.png){:style="width:100%;display: block;max-width:300px; margin-left:auto; margin-right:auto;"}
156+
157+
158+
The pipeline is highly customizable, where you can modify the detection or recognition model behaviors by passing arguments to the `ocr_predictor`. Please refer to the [documentation](https://mindee.github.io/doctr/using_doctr/using_models.html) to learn more about it.
159+
160+
161+
## Conclusion
162+
163+
We’re excited to welcome docTR into the PyTorch Ecosystem, where it seamlessly integrates with PyTorch pipelines to deliver state-of-the-art OCR capabilities right out of the box.
164+
165+
By empowering developers to quickly extract text from images or PDFs using familiar tooling, docTR simplifies complex document analysis tasks and enhances the overall PyTorch experience.
166+
167+
We invite you to explore the [docTR GitHub repository](https://github.com/mindee/doctr), join the [docTR community on Slack](https://slack.mindee.com/), and reach out at [email protected] for inquiries or collaboration opportunities.
168+
169+
Together, we can continue to push the boundaries of document understanding and develop even more powerful, accessible tools for everyone in the PyTorch community.

_sass/quick-start-module.scss

+4
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@
316316
content: url($baseurl + "/assets/images/microsoft-azure-logo.svg");
317317
}
318318

319+
&.lightning-studios:before {
320+
content: url($baseurl + "/assets/images/lightning-studios-logo.svg");
321+
}
322+
319323
&.google-cloud:before {
320324
content: url($baseurl + "/assets/images/google-cloud-logo.svg");
321325
}

assets/get-started-sidebar.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ $([".macos", ".linux", ".windows"]).each(function(index, osClass) {
44
buildSidebarMenu(osClass, "#get-started-locally-sidebar-list");
55
});
66

7-
$([".alibaba", ".aws", ".microsoft-azure", ".google-cloud"]).each(function(index, cloudPartner) {
7+
$([".alibaba", ".aws", ".microsoft-azure", ".google-cloud", ".lightning-studios"]).each(function(index, cloudPartner) {
88
buildSidebarMenu(cloudPartner, "#get-started-cloud-sidebar-list");
99
});
1010

@@ -15,7 +15,7 @@ $(["macos", "linux", "windows"]).each(function(index, osClass) {
1515
});
1616

1717
// Show cloud partner side nav on click or hide side nav if already open
18-
$(["alibaba", "aws", "microsoft-azure", "google-cloud"]).each(function(index, sidebarClass) {
18+
$(["alibaba", "aws", "microsoft-azure", "google-cloud", "lightning-studios"]).each(function(index, sidebarClass) {
1919
$("#" + sidebarClass).click(function() {
2020
showSidebar(sidebarClass, ".get-started-cloud-sidebar li");
2121
// alibaba filter for centering cloud module
Loading
Loading
Loading
Loading
Loading
Loading
+3
Loading

assets/quick-start-module.js

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var supportedCloudPlatforms = [
2727
'aws',
2828
'google-cloud',
2929
'microsoft-azure',
30+
'lightning-studios',
3031
];
3132

3233
var os = $(".os > .option");

0 commit comments

Comments
 (0)