Instructions to use Mayank022/Transformer-Vision-From-Image-Video-to-World-Models-and-Robotics-Book with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mayank022/Transformer-Vision-From-Image-Video-to-World-Models-and-Robotics-Book with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Mayank022/Transformer-Vision-From-Image-Video-to-World-Models-and-Robotics-Book", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Document verified local weight cleanup
Browse files
chapter-04-efficient-and-scalable-vision-transformers/EXPERIMENT_REPORT.md
CHANGED
|
@@ -16,8 +16,8 @@ deployment cost. Just as importantly, the benchmark showed why parameter count,
|
|
| 16 |
operations, latency, and throughput must be measured separately.
|
| 17 |
|
| 18 |
> **Experiment status:** complete. All 13 training runs reached 20 epochs, all 24 inference cases
|
| 19 |
-
> completed, the report artifacts were generated, and all 13 validation-selected
|
| 20 |
-
>
|
| 21 |
|
| 22 |
---
|
| 23 |
|
|
@@ -525,8 +525,8 @@ The completed local result bundle is
|
|
| 525 |
| [`model_profiles.csv`](results/model_profiles.csv) | Parameters, MACs, and unsupported tracing operators |
|
| 526 |
| [`inference_benchmark.csv`](results/inference_benchmark.csv) | All 24 timing and memory cases |
|
| 527 |
| [`report.md`](results/report.md) | Automatically generated compact report |
|
| 528 |
-
| [
|
| 529 |
-
| [
|
| 530 |
|
| 531 |
### Hugging Face distribution
|
| 532 |
|
|
@@ -543,14 +543,19 @@ Apache-2.0 and the Swin-T source reports MIT. The published inference files cont
|
|
| 543 |
scheduler, gradient-scaler, or random-number-generator state.
|
| 544 |
|
| 545 |
The Hugging Face checkpoint directory contains 13 model-only
|
| 546 |
-
`model.safetensors` files totaling approximately 1.06 GiB.
|
| 547 |
-
|
| 548 |
-
|
| 549 |
|
| 550 |
-
To verify every
|
| 551 |
|
| 552 |
```bash
|
| 553 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 554 |
shasum -a 256 -c SHA256SUMS
|
| 555 |
```
|
| 556 |
|
|
@@ -607,18 +612,23 @@ Ruff and mypy completed cleanly.
|
|
| 607 |
|
| 608 |
## 14. Loading a downloaded checkpoint
|
| 609 |
|
| 610 |
-
The Hugging Face files contain model parameters only and use Safetensors. This example
|
| 611 |
-
validation-selected ViT on CPU
|
| 612 |
|
| 613 |
```python
|
| 614 |
-
from
|
| 615 |
-
|
| 616 |
from safetensors.torch import load_file
|
| 617 |
import timm
|
| 618 |
|
| 619 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 620 |
"checkpoints/vit-s16/standard/seed-42/model.safetensors"
|
| 621 |
)
|
|
|
|
| 622 |
state_dict = load_file(weights_path, device="cpu")
|
| 623 |
|
| 624 |
model = timm.create_model(
|
|
|
|
| 16 |
operations, latency, and throughput must be measured separately.
|
| 17 |
|
| 18 |
> **Experiment status:** complete. All 13 training runs reached 20 epochs, all 24 inference cases
|
| 19 |
+
> completed, the report artifacts were generated, and all 13 validation-selected model states were
|
| 20 |
+
> published to Hugging Face and verified before their local weight copies were removed.
|
| 21 |
|
| 22 |
---
|
| 23 |
|
|
|
|
| 525 |
| [`model_profiles.csv`](results/model_profiles.csv) | Parameters, MACs, and unsupported tracing operators |
|
| 526 |
| [`inference_benchmark.csv`](results/inference_benchmark.csv) | All 24 timing and memory cases |
|
| 527 |
| [`report.md`](results/report.md) | Automatically generated compact report |
|
| 528 |
+
| [Hugging Face checkpoints](https://huggingface.co/Mayank022/Transformer-Vision-From-Image-Video-to-World-Models-and-Robotics-Book/tree/main/chapter-04-efficient-and-scalable-vision-transformers/checkpoints) | Thirteen public model-only Safetensors files |
|
| 529 |
+
| [Hugging Face manifest](https://huggingface.co/Mayank022/Transformer-Vision-From-Image-Video-to-World-Models-and-Robotics-Book/blob/main/chapter-04-efficient-and-scalable-vision-transformers/manifest.json) | Model paths, metrics, source hashes, and exported hashes |
|
| 530 |
|
| 531 |
### Hugging Face distribution
|
| 532 |
|
|
|
|
| 543 |
scheduler, gradient-scaler, or random-number-generator state.
|
| 544 |
|
| 545 |
The Hugging Face checkpoint directory contains 13 model-only
|
| 546 |
+
`model.safetensors` files totaling approximately 1.06 GiB. Their local source and
|
| 547 |
+
temporary export copies were removed after public hash verification. Complete resumable `best.pt`
|
| 548 |
+
and `latest.pt` artifacts remain on the Modal volume.
|
| 549 |
|
| 550 |
+
To download and verify every published model file:
|
| 551 |
|
| 552 |
```bash
|
| 553 |
+
hf download \
|
| 554 |
+
Mayank022/Transformer-Vision-From-Image-Video-to-World-Models-and-Robotics-Book \
|
| 555 |
+
--include "chapter-04-efficient-and-scalable-vision-transformers/checkpoints/*" \
|
| 556 |
+
--local-dir transformer-vision-book
|
| 557 |
+
|
| 558 |
+
cd transformer-vision-book/chapter-04-efficient-and-scalable-vision-transformers/checkpoints
|
| 559 |
shasum -a 256 -c SHA256SUMS
|
| 560 |
```
|
| 561 |
|
|
|
|
| 612 |
|
| 613 |
## 14. Loading a downloaded checkpoint
|
| 614 |
|
| 615 |
+
The Hugging Face files contain model parameters only and use Safetensors. This example downloads and
|
| 616 |
+
restores the validation-selected ViT on CPU:
|
| 617 |
|
| 618 |
```python
|
| 619 |
+
from huggingface_hub import hf_hub_download
|
|
|
|
| 620 |
from safetensors.torch import load_file
|
| 621 |
import timm
|
| 622 |
|
| 623 |
+
repo_id = (
|
| 624 |
+
"Mayank022/"
|
| 625 |
+
"Transformer-Vision-From-Image-Video-to-World-Models-and-Robotics-Book"
|
| 626 |
+
)
|
| 627 |
+
filename = (
|
| 628 |
+
"chapter-04-efficient-and-scalable-vision-transformers/"
|
| 629 |
"checkpoints/vit-s16/standard/seed-42/model.safetensors"
|
| 630 |
)
|
| 631 |
+
weights_path = hf_hub_download(repo_id=repo_id, filename=filename)
|
| 632 |
state_dict = load_file(weights_path, device="cpu")
|
| 633 |
|
| 634 |
model = timm.create_model(
|