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
data: attach pinned training dataset index and safe recovery helpers
Browse files- CHECKSUMS.sha256 +5 -2
- README.md +20 -0
- TRAINING_DATA_INDEX.json +0 -0
- bundle_manifest.json +26 -4
- tools/fetch_training_data.py +53 -0
- tools/restore_legacy_mix6.py +40 -0
CHECKSUMS.sha256
CHANGED
|
@@ -45,7 +45,10 @@ d89ef49ce9cd37fbf510158e13c1ef063d9286411c1ec9049932dbe0487143b1 legacy_grpo_st
|
|
| 45 |
33dc3c75269c0d037cb371b8b73116e10080da289911abfbe3648aac3a98f88a tools/reshard_safetensors.py
|
| 46 |
7f54d5b05d644bdc5c8c4a8450e45826ece512c9d2ec391896dde284d5fea552 tests/test_reshard_safetensors.py
|
| 47 |
c602d4305f59c388105765835b3b7d9cacf2181e8494014fea7f0dc57e728cb8 tools/verify_model_bundle.py
|
| 48 |
-
|
| 49 |
c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 LICENSES/Apache-2.0.txt
|
| 50 |
c9b258698bab0fabc1939cc09f0de24992c8b55eb63d4ba21e8803356cdc3320 LICENSES/UPSTREAM.md
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
33dc3c75269c0d037cb371b8b73116e10080da289911abfbe3648aac3a98f88a tools/reshard_safetensors.py
|
| 46 |
7f54d5b05d644bdc5c8c4a8450e45826ece512c9d2ec391896dde284d5fea552 tests/test_reshard_safetensors.py
|
| 47 |
c602d4305f59c388105765835b3b7d9cacf2181e8494014fea7f0dc57e728cb8 tools/verify_model_bundle.py
|
| 48 |
+
d8f10883a186b67cfcc14d88cffc55a1df582b44a315f57ce9a8a498576fbb76 README.md
|
| 49 |
c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 LICENSES/Apache-2.0.txt
|
| 50 |
c9b258698bab0fabc1939cc09f0de24992c8b55eb63d4ba21e8803356cdc3320 LICENSES/UPSTREAM.md
|
| 51 |
+
2569cdcdb30128ffb7d1f178a2669580ead36e532f9f8c65a67f0f25c543caaf TRAINING_DATA_INDEX.json
|
| 52 |
+
67acb0f58a052ce7fd309e50cdaf473a9880bc31a8d1c7f68212d528088d275c tools/fetch_training_data.py
|
| 53 |
+
4cd8ba59a93ab631419f29b61153ab8024cc7392f81fca1e0470c400144c8826 tools/restore_legacy_mix6.py
|
| 54 |
+
ca2360e169f3c6898793738c45a537603ce66fddf9546390644b5f62b7fec120 bundle_manifest.json
|
README.md
CHANGED
|
@@ -82,3 +82,23 @@ python tools/verify_model_bundle.py --bundle /your/downloaded/trick-prediction
|
|
| 82 |
Repository: `diffusion-gif/trick-prediction` (`model`, Public). All listed tensor files are complete and remote hashes verified.
|
| 83 |
Source export execution booleans describe the original local export, not current Hub upload status.
|
| 84 |
See `LICENSES/UPSTREAM.md` for upstream attribution and component licenses.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
Repository: `diffusion-gif/trick-prediction` (`model`, Public). All listed tensor files are complete and remote hashes verified.
|
| 83 |
Source export execution booleans describe the original local export, not current Hub upload status.
|
| 84 |
See `LICENSES/UPSTREAM.md` for upstream attribution and component licenses.
|
| 85 |
+
|
| 86 |
+
## Historical training-data index
|
| 87 |
+
|
| 88 |
+
`TRAINING_DATA_INDEX.json` is attached to this model download. It identifies
|
| 89 |
+
retained ORIGINAL training JSON/CSV/Parquet, pinned protected snapshot revisions,
|
| 90 |
+
file hashes, original legacy observation backups and separately labeled later data.
|
| 91 |
+
Original restricted annotations remain private; no data-owner credentials are included.
|
| 92 |
+
|
| 93 |
+
Public registry: https://huggingface.co/datasets/diffusion-gif/training-data-index
|
| 94 |
+
|
| 95 |
+
```bash
|
| 96 |
+
# For old trajectory checkpoints; inspect other dataset IDs for Any2Ego:
|
| 97 |
+
python tools/fetch_training_data.py --index TRAINING_DATA_INDEX.json --dataset legacy_mix6_sft --output data_download
|
| 98 |
+
# after owner login / dry-run inspection add --execute
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
A pointer index cannot guarantee that an unbacked original video remains available
|
| 102 |
+
forever. The large Ego-Exo RGB/GT-mask collection is not mirrored here. Launch-time
|
| 103 |
+
content hashes were not recorded for all components; current retained snapshots
|
| 104 |
+
and actual verified path bindings are explicitly distinguished in the index.
|
TRAINING_DATA_INDEX.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
bundle_manifest.json
CHANGED
|
@@ -260,8 +260,8 @@
|
|
| 260 |
},
|
| 261 |
{
|
| 262 |
"path": "README.md",
|
| 263 |
-
"bytes":
|
| 264 |
-
"sha256": "
|
| 265 |
},
|
| 266 |
{
|
| 267 |
"path": "LICENSES/Apache-2.0.txt",
|
|
@@ -272,15 +272,37 @@
|
|
| 272 |
"path": "LICENSES/UPSTREAM.md",
|
| 273 |
"bytes": 687,
|
| 274 |
"sha256": "c9b258698bab0fabc1939cc09f0de24992c8b55eb63d4ba21e8803356cdc3320"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
}
|
| 276 |
],
|
| 277 |
-
"total_file_bytes":
|
| 278 |
"source_export_identity_sha256": "29f1a102714ddfb0c5a6c6db580ee1a62a27fc46562e6fe783c4b7c2a3a088e5",
|
| 279 |
"distribution": {
|
| 280 |
"repo_id": "diffusion-gif/trick-prediction",
|
| 281 |
"repo_type": "model",
|
| 282 |
"visibility": "public",
|
| 283 |
-
"publication_phase": "complete"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
},
|
| 285 |
"validation": {
|
| 286 |
"source_shard_SHA256_verified_before_upload": true,
|
|
|
|
| 260 |
},
|
| 261 |
{
|
| 262 |
"path": "README.md",
|
| 263 |
+
"bytes": 5390,
|
| 264 |
+
"sha256": "d8f10883a186b67cfcc14d88cffc55a1df582b44a315f57ce9a8a498576fbb76"
|
| 265 |
},
|
| 266 |
{
|
| 267 |
"path": "LICENSES/Apache-2.0.txt",
|
|
|
|
| 272 |
"path": "LICENSES/UPSTREAM.md",
|
| 273 |
"bytes": 687,
|
| 274 |
"sha256": "c9b258698bab0fabc1939cc09f0de24992c8b55eb63d4ba21e8803356cdc3320"
|
| 275 |
+
},
|
| 276 |
+
{
|
| 277 |
+
"path": "TRAINING_DATA_INDEX.json",
|
| 278 |
+
"bytes": 146175,
|
| 279 |
+
"sha256": "2569cdcdb30128ffb7d1f178a2669580ead36e532f9f8c65a67f0f25c543caaf"
|
| 280 |
+
},
|
| 281 |
+
{
|
| 282 |
+
"path": "tools/fetch_training_data.py",
|
| 283 |
+
"bytes": 3237,
|
| 284 |
+
"sha256": "67acb0f58a052ce7fd309e50cdaf473a9880bc31a8d1c7f68212d528088d275c"
|
| 285 |
+
},
|
| 286 |
+
{
|
| 287 |
+
"path": "tools/restore_legacy_mix6.py",
|
| 288 |
+
"bytes": 2642,
|
| 289 |
+
"sha256": "4cd8ba59a93ab631419f29b61153ab8024cc7392f81fca1e0470c400144c8826"
|
| 290 |
}
|
| 291 |
],
|
| 292 |
+
"total_file_bytes": 109467946720,
|
| 293 |
"source_export_identity_sha256": "29f1a102714ddfb0c5a6c6db580ee1a62a27fc46562e6fe783c4b7c2a3a088e5",
|
| 294 |
"distribution": {
|
| 295 |
"repo_id": "diffusion-gif/trick-prediction",
|
| 296 |
"repo_type": "model",
|
| 297 |
"visibility": "public",
|
| 298 |
+
"publication_phase": "complete",
|
| 299 |
+
"training_data_index": {
|
| 300 |
+
"repo_id": "diffusion-gif/training-data-index",
|
| 301 |
+
"repo_type": "dataset",
|
| 302 |
+
"revision": "04182e349e581ce2f5826eb4a7bed2803b2925fc",
|
| 303 |
+
"path": "TRAINING_DATA_INDEX.json",
|
| 304 |
+
"source_JSON_sha256": "2569cdcdb30128ffb7d1f178a2669580ead36e532f9f8c65a67f0f25c543caaf"
|
| 305 |
+
}
|
| 306 |
},
|
| 307 |
"validation": {
|
| 308 |
"source_shard_SHA256_verified_before_upload": true,
|
tools/fetch_training_data.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Fetch pinned training files from the JSON index; dry-run unless --execute."""
|
| 3 |
+
import argparse,hashlib,json,shutil
|
| 4 |
+
from pathlib import Path,PurePosixPath
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def safe(value):
|
| 8 |
+
p=PurePosixPath(value)
|
| 9 |
+
if p.is_absolute() or '..' in p.parts or not p.parts:raise ValueError('Unsafe relative data path')
|
| 10 |
+
return Path(*p.parts)
|
| 11 |
+
|
| 12 |
+
def sha(path):
|
| 13 |
+
h=hashlib.sha256()
|
| 14 |
+
with Path(path).open('rb') as f:
|
| 15 |
+
for b in iter(lambda:f.read(8*1024*1024),b''):h.update(b)
|
| 16 |
+
return h.hexdigest()
|
| 17 |
+
|
| 18 |
+
def main():
|
| 19 |
+
p=argparse.ArgumentParser(description=__doc__)
|
| 20 |
+
directory=Path(__file__).absolute().parent
|
| 21 |
+
default_index=directory/'TRAINING_DATA_INDEX.json'
|
| 22 |
+
if not default_index.exists():default_index=directory.parent/'TRAINING_DATA_INDEX.json'
|
| 23 |
+
p.add_argument('--index',type=Path,default=default_index)
|
| 24 |
+
p.add_argument('--dataset',default='legacy_mix6_sft')
|
| 25 |
+
p.add_argument('--output',type=Path,default=Path('training_data_download'))
|
| 26 |
+
p.add_argument('--execute',action='store_true');a=p.parse_args()
|
| 27 |
+
index=json.loads(a.index.read_text());datasets={d['dataset_id']:d for d in index['datasets']}
|
| 28 |
+
if a.dataset=='all_private':ids={r['artifact_id'] for r in index['private_artifacts']}
|
| 29 |
+
elif a.dataset in datasets:ids=set(datasets[a.dataset].get('artifact_ids',[]))
|
| 30 |
+
else:raise ValueError('Unknown dataset ID; inspect index.datasets')
|
| 31 |
+
rows=[r for r in index['private_artifacts'] if r['artifact_id'] in ids]
|
| 32 |
+
if not rows:raise ValueError('No private snapshot artifacts for this dataset; inspect public download location')
|
| 33 |
+
source=index['private_snapshot']
|
| 34 |
+
if not source['repo_id'].startswith('diffusion-gif/training-data-vault-') or source['repo_type']!='dataset' or not source['private']:raise ValueError('Unexpected private data provider')
|
| 35 |
+
print(json.dumps({'dataset':a.dataset,'files':len(rows),'bytes':sum(r['bytes'] for r in rows),'source_repo':source['repo_id'],'revision':source['revision'],'login_required':True,'execute':a.execute},indent=2))
|
| 36 |
+
if not a.execute:return
|
| 37 |
+
from huggingface_hub import get_token,hf_hub_download
|
| 38 |
+
token=get_token()
|
| 39 |
+
if not token:raise RuntimeError('Run hf auth login locally using an account authorized for the private vault. Never put tokens in this file or chat.')
|
| 40 |
+
a.output.mkdir(parents=True,exist_ok=True)
|
| 41 |
+
for r in rows:
|
| 42 |
+
target=a.output/safe(r['path'])
|
| 43 |
+
if target.exists():
|
| 44 |
+
if not target.is_file() or target.stat().st_size!=r['bytes'] or sha(target)!=r['sha256']:raise ValueError('Existing user file differs; will not overwrite')
|
| 45 |
+
continue
|
| 46 |
+
cached=Path(hf_hub_download(repo_id=source['repo_id'],repo_type='dataset',revision=source['revision'],filename=r['path'],token=token,endpoint='https://huggingface.co'))
|
| 47 |
+
if cached.stat().st_size!=r['bytes'] or sha(cached)!=r['sha256']:raise ValueError('Downloaded file SHA256 mismatch')
|
| 48 |
+
target.parent.mkdir(parents=True,exist_ok=True);temporary=target.with_name(target.name+'.copy-partial')
|
| 49 |
+
shutil.copyfile(cached,temporary)
|
| 50 |
+
if sha(temporary)!=r['sha256']:raise ValueError('Copied file SHA256 mismatch')
|
| 51 |
+
temporary.replace(target);print('VERIFIED',r['path'],flush=True)
|
| 52 |
+
print('Done: all selected frozen files downloaded and SHA256 verified. See restore_legacy_mix6.py for a relocatable SFT working copy.')
|
| 53 |
+
if __name__=='__main__':main()
|
tools/restore_legacy_mix6.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Restore legacy SFT observations/JSON working copies; never alter frozen files."""
|
| 3 |
+
import argparse,hashlib,json,tarfile
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
def main():
|
| 7 |
+
p=argparse.ArgumentParser(description=__doc__);p.add_argument('--snapshot-root',required=True,type=Path);p.add_argument('--output',required=True,type=Path);p.add_argument('--execute',action='store_true');a=p.parse_args()
|
| 8 |
+
src=a.snapshot_root/'legacy_mix6';locations={}
|
| 9 |
+
for line in (src/'observations/locations.private.jsonl').open():
|
| 10 |
+
r=json.loads(line);key=(r['split'],r['sid'])
|
| 11 |
+
if key in locations:raise ValueError('Duplicate observation ID')
|
| 12 |
+
if Path(r['archive']).name!=r['archive'] or Path(r['member']).name!=r['member']:raise ValueError('Unsafe archive/member path')
|
| 13 |
+
locations[key]=r
|
| 14 |
+
if not a.execute:
|
| 15 |
+
print(json.dumps({'records':len(locations),'output':str(a.output),'source_snapshot_modified':False,'execute':False},indent=2));return
|
| 16 |
+
if a.output.exists() and any(a.output.iterdir()):raise ValueError('Output must be a new/empty directory; will not overwrite user files')
|
| 17 |
+
a.output.mkdir(parents=True,exist_ok=True);by_archive={}
|
| 18 |
+
for key,r in locations.items():by_archive.setdefault(r['archive'],{})[r['member']]=(key,r)
|
| 19 |
+
for name,entries in by_archive.items():
|
| 20 |
+
with tarfile.open(src/'observations'/name,'r:') as archive:
|
| 21 |
+
for member in archive:
|
| 22 |
+
entry=entries.pop(member.name,None)
|
| 23 |
+
if entry is None or not member.isfile():raise ValueError('Unexpected archive entry')
|
| 24 |
+
(split,sid),r=entry;data=archive.extractfile(member).read()
|
| 25 |
+
if len(data)!=r['bytes'] or hashlib.sha256(data).hexdigest()!=r['sha256']:raise ValueError('Original NPZ checksum differs')
|
| 26 |
+
filename=hashlib.sha256(sid.encode()).hexdigest()[:32]+'.npz'
|
| 27 |
+
target=a.output/'frames'/split/filename;target.parent.mkdir(parents=True,exist_ok=True)
|
| 28 |
+
if target.exists():raise ValueError('Duplicate target frame file')
|
| 29 |
+
target.write_bytes(data)
|
| 30 |
+
if entries:raise ValueError('Missing observation member')
|
| 31 |
+
for split in ('train','heldout'):
|
| 32 |
+
with (src/'sft'/(split+'.jsonl')).open() as inp,(a.output/(split+'.jsonl')).open('w') as out:
|
| 33 |
+
for line in inp:
|
| 34 |
+
r=json.loads(line)
|
| 35 |
+
if (split,r['sid']) not in locations:raise ValueError('Input record lacks backed-up observation')
|
| 36 |
+
r['frames_root']=str((a.output/'frames'/split).resolve())
|
| 37 |
+
r['npz']=hashlib.sha256(r['sid'].encode()).hexdigest()[:32]+'.npz'
|
| 38 |
+
out.write(json.dumps(r,ensure_ascii=False)+'\n')
|
| 39 |
+
print('Restored exact NPZ bytes and re-based SFT train/heldout JSONL. Only npz/frames_root fields in WORKING copies changed; frozen originals are intact.')
|
| 40 |
+
if __name__=='__main__':main()
|