Instructions to use OpenGVLab/VideoChat-TPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/VideoChat-TPO with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OpenGVLab/VideoChat-TPO", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download third_party/cgdetr/utils/model_utils.py from OpenGVLab/VideoChat-TPO: direct link, hf CLI and curl.
- Browser
- Download file 583 Bytes
-
https://huggingface.co/OpenGVLab/VideoChat-TPO/resolve/refs%2Fpr%2F2/third_party/cgdetr/utils/model_utils.py
- Command line
-
hf download hf://OpenGVLab/VideoChat-TPO@refs/pr/2/third_party/cgdetr/utils/model_utils.py
-
curl -L -o model_utils.py https://huggingface.co/OpenGVLab/VideoChat-TPO/resolve/refs%2Fpr%2F2/third_party/cgdetr/utils/model_utils.py
583 Bytes
| def count_parameters(model, verbose=True): | |
| """Count number of parameters in PyTorch model, | |
| References: https://discuss.pytorch.org/t/how-do-i-check-the-number-of-parameters-of-a-model/4325/7. | |
| from utils.utils import count_parameters | |
| count_parameters(model) | |
| import sys | |
| sys.exit(1) | |
| """ | |
| n_all = sum(p.numel() for p in model.parameters()) | |
| n_trainable = sum(p.numel() for p in model.parameters() if p.requires_grad) | |
| if verbose: | |
| print("Parameter Count: all {:,d}; trainable {:,d}".format(n_all, n_trainable)) | |
| return n_all, n_trainable | |