Instructions to use diffusion-gif/trick-prediction with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use diffusion-gif/trick-prediction with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="diffusion-gif/trick-prediction")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("diffusion-gif/trick-prediction", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use diffusion-gif/trick-prediction with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "diffusion-gif/trick-prediction" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "diffusion-gif/trick-prediction", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/diffusion-gif/trick-prediction
- SGLang
How to use diffusion-gif/trick-prediction with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "diffusion-gif/trick-prediction" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "diffusion-gif/trick-prediction", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "diffusion-gif/trick-prediction" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "diffusion-gif/trick-prediction", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use diffusion-gif/trick-prediction with Docker Model Runner:
docker model run hf.co/diffusion-gif/trick-prediction
Download tools/verify_model_bundle.py from diffusion-gif/trick-prediction: direct link, hf CLI and curl.
- Browser
- Download file 1.79 kB
-
https://huggingface.co/diffusion-gif/trick-prediction/resolve/main/tools/verify_model_bundle.py
- Command line
-
hf download hf://diffusion-gif/trick-prediction/tools/verify_model_bundle.py
-
curl -L -o verify_model_bundle.py https://huggingface.co/diffusion-gif/trick-prediction/resolve/main/tools/verify_model_bundle.py
1.79 kB
| #!/usr/bin/env python3 | |
| """Verify the exported model bundle using only the standard library, on CPU.""" | |
| import argparse | |
| import hashlib | |
| import json | |
| from pathlib import Path | |
| import sys | |
| def verify(root): | |
| root = Path(root).resolve() | |
| manifest = json.loads((root / 'bundle_manifest.json').read_text()) | |
| if manifest.get('status') != 'complete': | |
| raise ValueError('bundle is not marked complete') | |
| limit = manifest['max_file_bytes'] | |
| total = 0 | |
| for row in manifest['files']: | |
| relative = Path(row['path']) | |
| if relative.is_absolute() or '..' in relative.parts: | |
| raise ValueError('unsafe manifest path') | |
| path = root / relative | |
| if path.is_symlink() or not path.is_file() or path.stat().st_size != row['bytes']: | |
| raise ValueError('missing/changed file: ' + str(relative)) | |
| if path.stat().st_size > limit: | |
| raise ValueError('file exceeds upload shard limit: ' + str(relative)) | |
| digest = hashlib.sha256() | |
| with path.open('rb') as handle: | |
| for block in iter(lambda: handle.read(8*1024*1024), b''): | |
| digest.update(block) | |
| if digest.hexdigest() != row['sha256']: | |
| raise ValueError('SHA256 differs: ' + str(relative)) | |
| total += row['bytes'] | |
| print(json.dumps({'status': 'verified', 'files': len(manifest['files']), | |
| 'file_bytes': total, 'max_file_bytes': limit, | |
| 'GPU_used': False, 'model_loaded': False}, indent=2)) | |
| return manifest | |
| def main(): | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument('--bundle', type=Path, default=Path(__file__).resolve().parents[1]) | |
| args = parser.parse_args() | |
| verify(args.bundle) | |
| if __name__ == '__main__': | |
| main() | |