Robotics
Transformers
Safetensors
openvla
feature-extraction
vision-language-action
vla
libero
vla-adapter
custom_code
Instructions to use Zenma/VLA-Adapter-LIBERO-Spatial-5000 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Zenma/VLA-Adapter-LIBERO-Spatial-5000 with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForVision2Seq model = AutoModelForVision2Seq.from_pretrained("Zenma/VLA-Adapter-LIBERO-Spatial-5000", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload VLA-Adapter checkpoint
Browse filesFiles changed (17)
- README.mdAdded+68
- action_head--checkpoint.ptAdded+3
- added_tokens.jsonAdded+24
- config.jsonAdded+3182
- configuration_prismatic.pyAdded+144
- dataset_statistics.jsonAdded+133
- generation_config.jsonAdded+7
- merges.txtAdded
- model.safetensorsAdded+3
- modeling_prismatic.pyAdded+1001
- preprocessor_config.jsonAdded+114
- processing_prismatic.pyAdded+252
- proprio_projector--checkpoint.ptAdded+3
- special_tokens_map.jsonAdded+31
- tokenizer.jsonAdded
- tokenizer_config.jsonAdded+211
- vocab.jsonAdded
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768---library_name: transformerspipeline_tag: roboticslicense: mittags:- robotics- vision-language-action- vla- libero- openvla- vla-adapter---
# VLA-Adapter-LIBERO-Spatial-5000
VLA-Adapter policy: a Qwen2.5-0.5B prism backbone (fused DINOv2 + SigLIP vision)with a layer-wise Bridge-Attention action head, fine-tuned on LIBERO.
| | ||---|---|| Backbone | qwen25-0_5b-extra || LLM | 896 hidden x 24 layers || Vision | vit_large_patch14_reg4_dinov2.lvd142m + vit_so400m_patch14_siglip_224 || Image size | 224x224 || Action head | MLP-ResNet, Bridge Attention (Pro) || Objective | L1 regression over the action chunk || Checkpoint | configs+libero_spatial_no_noops+b16+lr-0.0001+lora-r64+dropout-0.0--image_aug--VLA-Adapter--libero_spatial_no_noops--20260727_221630--5000_chkpt || unnorm_key | `libero_spatial_no_noops` || Evaluated on | libero_spatial |
Component files were renamed to the convention the evaluation loader expects:
- `action_head--5000_checkpoint.pt` -> `action_head--checkpoint.pt`- `proprio_projector--5000_checkpoint.pt` -> `proprio_projector--checkpoint.pt`
## Evaluating
The evaluation code loads the action head and proprio projector from a localdirectory, and only accepts a Hub repo id if it is in its hardcoded allowlist,so download the repo first:
```bashhf download Zenma/VLA-Adapter-LIBERO-Spatial-5000 --local-dir ckpts/VLA-Adapter-LIBERO-Spatial-5000
python experiments/robot/libero/run_libero_eval.py \ --pretrained_checkpoint ckpts/VLA-Adapter-LIBERO-Spatial-5000 \ --task_suite_name libero_spatial \ --num_images_in_input 2 \ --use_proprio True \ --use_l1_regression True \ --num_open_loop_steps 8```
`use_pro_version` is inferred from whether the checkpoint path contains "Pro",so keep that substring in the directory name -- this checkpoint is a Pro head.
## Loading the VLM alone
```pythonfrom transformers import AutoModelForVision2Seq, AutoProcessor
processor = AutoProcessor.from_pretrained("Zenma/VLA-Adapter-LIBERO-Spatial-5000", trust_remote_code=True)vla = AutoModelForVision2Seq.from_pretrained("Zenma/VLA-Adapter-LIBERO-Spatial-5000", trust_remote_code=True)```
This gives the backbone only. Action prediction additionally needs`action_head--checkpoint.pt` and `proprio_projector--checkpoint.pt` from thisrepo, instantiated as in `experiments/robot/openvla_utils.py`.123version https://git-lfs.github.com/spec/v1oid sha256:a2eafae2d15aae6079d3ef78ff6ac31d135786ab22e8462edb92f3eeb6351803size 435954445123456789101112131415161718192021222324{ "</tool_call>": 151658, "<tool_call>": 151657, "<|box_end|>": 151649, "<|box_start|>": 151648, "<|endoftext|>": 151643, "<|file_sep|>": 151664, "<|fim_middle|>": 151660, "<|fim_pad|>": 151662, "<|fim_prefix|>": 151659, "<|fim_suffix|>": 151661, "<|im_end|>": 151645, "<|im_start|>": 151644, "<|image_pad|>": 151655, "<|object_ref_end|>": 151647, "<|object_ref_start|>": 151646, "<|quad_end|>": 151651, "<|quad_start|>": 151650, "<|repo_name|>": 151663, "<|video_pad|>": 151656, "<|vision_end|>": 151653, "<|vision_pad|>": 151654, "<|vision_start|>": 151652}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182{ "_name_or_path": "pretrained_models/configs/config.json", "arch_specifier": "no-align+fused-gelu-mlp", "architectures": [ "OpenVLAForActionPrediction" ], "auto_map": { "AutoConfig": "configuration_prismatic.OpenVLAConfig", "AutoModelForVision2Seq": "modeling_prismatic.OpenVLAForActionPrediction" }, "hf_llm_id": "", "image_resize_strategy": "resize-naive", "image_sizes": [ 224, 224 ], "llm_backbone_id": "qwen25-0_5b-extra", "llm_max_length": 2048, "model_type": "openvla", "n_action_bins": 256, "norm_stats": { "austin_buds_dataset_converted_externally_to_rlds": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0 ], "mean": [ -0.07678354531526566, 0.0036849044263362885, 0.05644911900162697, 0.0, 0.0, 0.0, 0.3510494828224182 ], "min": [ -1.0, -1.0, -1.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ -1.0, -0.9599999785423279, -0.8714285492897034, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 1.0, 0.8600000143051147, 1.0, 0.0, 0.0, 0.0, 1.0 ], "std": [ 0.6367740631103516, 0.37889179587364197, 0.47796326875686646, 0.0, 0.0, 0.0, 0.47721168398857117 ] }, "num_trajectories": 50, "num_transitions": 34112, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "austin_sailor_dataset_converted_externally_to_rlds": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 1.0, 1.0, 1.0, 0.0, 0.0, 0.375, 1.0 ], "mean": [ 0.011825348250567913, 0.006461074110120535, 0.06023626774549484, 0.0, 0.0, 0.0016465914668515325, 0.5260950326919556 ], "min": [ -1.0, -1.0, -1.0, 0.0, 0.0, -0.375, 0.0 ], "q01": [ -1.0, -0.9828571677207947, -0.6000000238418579, 0.0, 0.0, -0.17249999940395355, 0.0 ], "q99": [ 1.0, 0.9457142949104309, 1.0, 0.0, 0.0, 0.17892856895923615, 1.0 ], "std": [ 0.46348899602890015, 0.41240179538726807, 0.411862850189209, 0.0, 0.0, 0.0578610822558403, 0.49894046783447266 ] }, "num_trajectories": 240, "num_transitions": 353094, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "austin_sirius_dataset_converted_externally_to_rlds": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 1.0002285242080688, 0.960608720779419, 1.105179786682129, 0.0, 0.0, 0.341785728931427, 1.0 ], "mean": [ 0.07747682929039001, 0.03195561468601227, 0.04244732856750488, 0.0, 0.0, -0.01603456400334835, 0.43260177969932556 ], "min": [ -1.0183025598526, -0.9800000190734863, -0.9774575233459473, 0.0, 0.0, -0.34607142210006714, 0.0 ], "q01": [ -0.780905865430832, -0.5667179036140442, -0.5254343223571777, 0.0, 0.0, -0.28495091378688814, 0.0 ], "q99": [ 0.9569637751579284, 0.6971374487876891, 0.8124888157844541, 0.0, 0.0, 0.1971428543329239, 1.0 ], "std": [ 0.3906329572200775, 0.2998155355453491, 0.2782271206378937, 0.0, 0.0, 0.08120622485876083, 0.49528297781944275 ] }, "num_trajectories": 559, "num_transitions": 279939, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "bc_z": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.2165454924106598, 0.1251407265663147, 0.10772687941789627, 0.33544227480888367, 0.28117990493774414, 0.40614867210388184, 1.0 ], "mean": [ -0.009958467446267605, 0.0008958321413956583, 0.004995597992092371, 0.00029755113064311445, -0.008735382929444313, -0.030693737789988518, 0.8344562649726868 ], "min": [ -0.1677047461271286, -0.14630407094955444, -0.10066790133714676, -0.29421567916870117, -0.32101404666900635, -0.4635624885559082, 0.0 ], "q01": [ -0.09220654994249344, -0.06456145539879798, -0.049121275544166565, -0.11594625547528267, -0.14152548640966414, -0.2251061636209488, 0.0 ], "q99": [ 0.07628866866230968, 0.058019736707210584, 0.052540797740221024, 0.11740604028105736, 0.11703975558280955, 0.16729306846857078, 1.0 ], "std": [ 0.03053455986082554, 0.0231423731893301, 0.020641816779971123, 0.04155943542718887, 0.046427831053733826, 0.0769818127155304, 0.3610210120677948 ] }, "num_trajectories": 43264, "num_transitions": 6015535, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "berkeley_autolab_ur5": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.019999999552965164, 0.019999999552965164, 0.019999999552965164, 0.06666667014360428, 0.06666667014360428, 0.06666667014360428, 1.0 ], "mean": [ 0.0005683620693162084, 0.001217700308188796, -0.0005296372692100704, 0.00021029810886830091, 6.0695128922816366e-05, 0.001204986940138042, 0.6298308372497559 ], "min": [ -0.019999999552965164, -0.019999999552965164, -0.019999999552965164, -0.06666667014360428, -0.06666667014360428, -0.06666667014360428, 0.0 ], "q01": [ -0.019999999552965164, -0.019999999552965164, -0.019999999552965164, -0.02628571353852749, -0.06666667014360428, -0.03847619146108627, 0.0 ], "q99": [ 0.019999999552965164, 0.019999999552965164, 0.019999999552965164, 0.031809523701667786, 0.06666667014360428, 0.036571428179740906, 1.0 ], "std": [ 0.0115329809486866, 0.007990492507815361, 0.009577835910022259, 0.009432995691895485, 0.016427582129836082, 0.011053967289626598, 0.48267969489097595 ] }, "num_trajectories": 1000, "num_transitions": 97939, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "berkeley_cable_routing": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.9633283019065857, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0 ], "mean": [ -0.07139874249696732, 0.023609008640050888, 0.10241943597793579, 0.0, 0.0, 0.049671024084091187, 0.0 ], "min": [ -0.9809081554412842, -0.9554349184036255, -0.9994775056838989, 0.0, 0.0, -1.0, 0.0 ], "q01": [ -0.5534318816661835, -0.4797285574674606, -0.5314934802055359, 0.0, 0.0, -0.8855219376087189, 0.0 ], "q99": [ 0.42652835428714786, 0.5000944086909298, 0.639823433756829, 0.0, 0.0, 0.984243879914284, 0.0 ], "std": [ 0.1815500408411026, 0.1810990273952484, 0.21220779418945312, 0.0, 0.0, 0.3475511968135834, 0.0 ] }, "num_trajectories": 1647, "num_transitions": 42328, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "berkeley_fanuc_manipulation": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.009999999776482582, 0.009999999776482582, 0.009999999776482582, 0.03490658476948738, 0.03490658476948738, 0.03490658476948738, 1.0 ], "mean": [ 0.0007744057802483439, -0.00031240080716088414, -0.0015001941937953234, -0.0007515158504247665, -0.00015832878125365824, 0.00014327642566058785, 0.699295699596405 ], "min": [ -0.009999999776482582, -0.009999999776482582, -0.009999999776482582, -0.03490658476948738, -0.03490658476948738, -0.03490658476948738, 0.0 ], "q01": [ -0.009999999776482582, -0.009999999776482582, -0.009999999776482582, -0.03490658476948738, 0.0, -0.03490658476948738, 0.0 ], "q99": [ 0.009999999776482582, 0.009999999776482582, 0.009999999776482582, 0.03490658476948738, 0.0, 0.03490658476948738, 1.0 ], "std": [ 0.0034070091787725687, 0.0049921851605176926, 0.005344334989786148, 0.00759894959628582, 0.004081866703927517, 0.008568956516683102, 0.4586937427520752 ] }, "num_trajectories": 415, "num_transitions": 62613, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "bridge_orig": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.41691166162490845, 0.25864794850349426, 0.21218234300613403, 3.122201919555664, 1.8618112802505493, 6.280478477478027, 1.0 ], "mean": [ 0.0002334194869035855, 0.00013004911306779832, -0.00012762474943883717, -0.0001556558854645118, -0.0004039328487124294, 0.00023557482927571982, 0.5764579176902771 ], "min": [ -0.4007510244846344, -0.13874775171279907, -0.22553899884223938, -3.2010786533355713, -1.8618112802505493, -6.279075622558594, 0.0 ], "q01": [ -0.02872725307941437, -0.04170349963009357, -0.026093858778476715, -0.08092105075716972, -0.09288699507713317, -0.20718276381492615, 0.0 ], "q99": [ 0.028309678435325586, 0.040855254605412394, 0.040161586627364146, 0.08192047759890528, 0.07792850524187081, 0.20382574498653397, 1.0 ], "std": [ 0.009765930473804474, 0.013689135201275349, 0.012667362578213215, 0.028534092009067535, 0.030637972056865692, 0.07691419124603271, 0.4973701536655426 ] }, "num_trajectories": 60064, "num_transitions": 2135463, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "cmu_stretch": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.02338407188653946, 0.0, 0.023404927924275398, 0.0, 0.0, 0.0, 1.0 ], "mean": [ 0.00036304505192674696, 0.0, 0.0016466958913952112, 0.0, 0.0, 0.0, 0.3987048268318176 ], "min": [ -0.019353797659277916, 0.0, -0.02019215188920498, 0.0, 0.0, 0.0, 0.0 ], "q01": [ -0.011175686959177256, 0.0, -0.0032206363626755773, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.014501785952597848, 0.0, 0.015056106168776728, 0.0, 0.0, 0.0, 1.0 ], "std": [ 0.004081828519701958, 0.0, 0.0037743328139185905, 0.0, 0.0, 0.0, 0.48963725566864014 ] }, "num_trajectories": 135, "num_transitions": 25016, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "dlr_edan_shared_control_converted_externally_to_rlds": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.18991442024707794, 0.0739002525806427, 0.18064819276332855, 0.0866486132144928, 0.13464981317520142, 0.16910280287265778, 1.0 ], "mean": [ 0.006647810339927673, -0.0007657372043468058, 0.006522852927446365, 0.0011679717572405934, -0.006395625416189432, -0.011902998201549053, 0.6985887289047241 ], "min": [ -0.10054297000169754, -0.08427435159683228, -0.13533438742160797, -0.17556548118591309, -0.18485672771930695, -0.2680685818195343, 0.0 ], "q01": [ -0.02987122368067503, -0.06013262912631035, -0.08286409199237824, -0.05924444157630205, -0.15986866518855095, -0.15636983573436739, 0.0 ], "q99": [ 0.08832092039287087, 0.042126184627413736, 0.11311905644834042, 0.0643695573508739, 0.03941855944693088, 0.156646853685379, 1.0 ], "std": [ 0.021393608301877975, 0.01814231649041176, 0.03374375030398369, 0.01743541844189167, 0.03394376486539841, 0.04641875624656677, 0.4588589072227478 ] }, "num_trajectories": 104, "num_transitions": 8928, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "dobbe": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 38.590423583984375, 17.932697296142578, 4.843764305114746, 1.4372116327285767, 0.4340403974056244, 1.2057193517684937, 0.9998947381973267 ], "mean": [ -0.0001120665911003016, 0.0011229600058868527, -0.00010194431524723768, -7.371398532995954e-05, -0.00067531579406932, -5.6643435527803376e-05, 0.6318281888961792 ], "min": [ -5.700923442840576, -21.605947494506836, -123.72489929199219, -1.7229845523834229, -0.4998578727245331, -0.8867913484573364, 1.4196479014572105e-06 ], "q01": [ -0.01119564864784479, -0.014266146533191203, -0.0071747214533388615, -0.009444301575422287, -0.03990109823644161, -0.017422311007976532, 4.003279136668425e-05 ], "q99": [ 0.01015154086053368, 0.017181577533483497, 0.007216989761218411, 0.010380979906767595, 0.03556173853576176, 0.018032474815845446, 0.9982578039169312 ], "std": [ 0.04264938458800316, 0.04428559169173241, 0.12224084138870239, 0.005388413090258837, 0.011246449314057827, 0.006287882570177317, 0.39732322096824646 ] }, "num_trajectories": 5208, "num_transitions": 1139911, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "fmb_dataset": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 1.399999976158142, 1.0, 1.399999976158142, 1.0, 1.0, 1.0, 1.0 ], "mean": [ 0.059029702097177505, -0.06476633995771408, -0.09787475317716599, 0.004325388930737972, 0.00028963794466108084, -0.04457257315516472, 0.7336440086364746 ], "min": [ -1.399999976158142, -1.399999976158142, -1.0, -1.0, -1.0, -1.0, 0.0 ], "q01": [ -0.8257142901420593, -1.399999976158142, -1.0, -1.0, -0.3028571307659149, -1.0, 0.0 ], "q99": [ 1.0, 0.5257142782211304, 1.0, 1.0, 0.3400000035762787, 1.0, 1.0 ], "std": [ 0.28809213638305664, 0.2820415794849396, 0.4626740515232086, 0.3266514539718628, 0.10842999070882797, 0.3440099358558655, 0.4435282051563263 ] }, "num_trajectories": 8612, "num_transitions": 1137459, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "fractal20220817_data": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 2.9984593391418457, 22.09052848815918, 2.7507524490356445, 1.570636510848999, 1.5321086645126343, 1.5691522359848022, 1.0 ], "mean": [ 0.006987582892179489, 0.006265917327255011, -0.01262515690177679, 0.04333311319351196, -0.005756212864071131, 0.0009130256366916001, 0.5354204773902893 ], "min": [ -2.0204520225524902, -5.497899532318115, -2.031663417816162, -1.569917917251587, -1.569892168045044, -1.570419430732727, 0.0 ], "q01": [ -0.22453527510166169, -0.14820013284683228, -0.231589707583189, -0.3517994859814644, -0.4193011274933815, -0.43643461108207704, 0.0 ], "q99": [ 0.17824687153100965, 0.14938379630446405, 0.21842354819178575, 0.5892666035890578, 0.35272657424211445, 0.44796681255102094, 1.0 ], "std": [ 0.0692116990685463, 0.05970962345600128, 0.07353084534406662, 0.15610496699810028, 0.13164450228214264, 0.14593800902366638, 0.497110515832901 ] }, "num_trajectories": 87212, "num_transitions": 3786400, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "furniture_bench_dataset_converted_externally_to_rlds": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.10000000149011612, 0.10000000149011612, 0.10000000149011612, 0.8651833534240723, 1.0909736156463623, 2.863185405731201, 1.0 ], "mean": [ 0.00014610752987209707, 0.0010830952087417245, 0.0006224989192560315, -0.003303206292912364, -0.0026880695950239897, 0.018242603167891502, 0.48854944109916687 ], "min": [ -0.10495579987764359, -0.10939455777406693, -0.10000000149011612, -0.971906840801239, -1.0475432872772217, -3.06000018119812, 0.0 ], "q01": [ -0.053988199681043625, -0.05049169331789017, -0.032499241530895236, -0.1953887003660202, -0.41674559473991396, -0.8886768388748169, 0.0 ], "q99": [ 0.05414841488003723, 0.04965164884924884, 0.060055799782276154, 0.18231668293476103, 0.39867786407470646, 0.8772023963928218, 1.0 ], "std": [ 0.01610708422958851, 0.014891477301716805, 0.014014219865202904, 0.058274295181035995, 0.11417088657617569, 0.33479776978492737, 0.49991825222969055 ] }, "num_trajectories": 5100, "num_transitions": 3948057, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "iamlab_cmu_pickup_insert_converted_externally_to_rlds": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.6634981632232666, 0.23428471386432648, 0.4308285415172577, 3.1415927410125732, 0.13647015392780304, 3.141592502593994, 1.0 ], "mean": [ 0.5274372696876526, 0.02858201041817665, 0.18712575733661652, 1.2339589595794678, 0.03226623684167862, -1.4199490547180176, 0.5550631880760193 ], "min": [ 0.3071657121181488, -0.29754969477653503, 0.06578229367733002, -3.1415927410125732, -0.04584203287959099, -3.141592502593994, 0.0 ], "q01": [ 0.3148897051811218, -0.20317550599575043, 0.06785467118024827, -3.140952730178833, -0.029743434861302376, -3.141091251373291, 0.0 ], "q99": [ 0.6472805738449097, 0.20846802592277527, 0.36855655312538155, 3.1409926891326903, 0.11424950212240226, 3.1410969257354737, 1.0 ], "std": [ 0.08108345419168472, 0.1116757020354271, 0.07747554779052734, 2.8737246990203857, 0.02774704433977604, 2.7678682804107666, 0.49695101380348206 ] }, "num_trajectories": 631, "num_transitions": 146241, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "jaco_play": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.0, 0.0, 0.0, 1.0 ], "mean": [ 0.0009658430935814977, -0.00580078037455678, -0.00395062193274498, 0.0, 0.0, 0.0, 0.34934908151626587 ], "min": [ -0.20000000298023224, -0.20000000298023224, -0.20000000298023224, 0.0, 0.0, 0.0, 0.0 ], "q01": [ -0.20000000298023224, -0.20000000298023224, -0.20000000298023224, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.0, 0.0, 0.0, 1.0 ], "std": [ 0.12235074490308762, 0.09678777307271957, 0.11155334860086441, 0.0, 0.0, 0.0, 0.4768252968788147 ] }, "num_trajectories": 1085, "num_transitions": 77965, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "kuka": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.1697135865688324, 0.2777623236179352, 0.43710532784461975, 0.0, 0.0, 1.9684287309646606, 1.0 ], "mean": [ -0.0004668905457947403, 0.00040138536132872105, -0.001280792523175478, 0.0, 0.0, -0.03722453489899635, 0.4131543040275574 ], "min": [ -0.159867063164711, -0.2892282009124756, -0.2795473635196686, 0.0, 0.0, -1.9875637292861938, 0.0 ], "q01": [ -0.06619441494345665, -0.08713878810405731, -0.15083016991615295, 0.0, 0.0, -0.5415697038173676, 0.0 ], "q99": [ 0.06601839080452929, 0.08732476785779003, 0.18168179214000715, 0.0, 0.0, 0.2923380345106127, 1.0 ], "std": [ 0.02083250693976879, 0.02915887162089348, 0.06422865390777588, 0.0, 0.0, 0.14224295318126678, 0.49086448550224304 ] }, "num_trajectories": 209880, "num_transitions": 2455879, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "nyu_franka_play_dataset_converted_externally_to_rlds": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.06424188613891602, 0.07027634978294373, 0.06129661202430725, 6.281067848205566, 0.1967729926109314, 0.26377415657043457, 1.0 ], "mean": [ 0.001021989737637341, -0.00012002651783404872, 0.00032894269679673016, 0.0015034361276775599, -0.002198522910475731, -0.001663230243138969, 0.7230083346366882 ], "min": [ -0.05952230095863342, -0.07232445478439331, -0.06730806827545166, -6.278434753417969, -0.21479034423828125, -0.3627619743347168, 0.0 ], "q01": [ -0.03199600875377655, -0.032861671447753905, -0.03368805110454559, -0.12080862045288086, -0.12175218224525451, -0.11370223641395569, 0.0 ], "q99": [ 0.03101520001888276, 0.0373908892273903, 0.03646374464035038, 0.11764093399047852, 0.1258920183777809, 0.09366151213645942, 1.0 ], "std": [ 0.01327415369451046, 0.013215910643339157, 0.012822109274566174, 0.2732451558113098, 0.057022541761398315, 0.039172880351543427, 0.44752755761146545 ] }, "num_trajectories": 456, "num_transitions": 44875, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "roboturk": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.39124172925949097, 0.4601028263568878, 0.4870833456516266, 1.816888689994812, 1.8240282535552979, 1.4824820756912231, 1.0 ], "mean": [ 0.0014448732836171985, -0.0015945249469950795, -0.0011753785656765103, 0.0023012510500848293, -0.0009382463176734746, -0.00011485807772260159, 0.5746025443077087 ], "min": [ -0.6546999216079712, -0.6365841031074524, -0.4217723608016968, -1.6695482730865479, -1.8023357391357422, -1.4630827903747559, 0.0 ], "q01": [ -0.1342635464668274, -0.19996687173843383, -0.1482972100377083, -0.20720748245716095, -0.09676413893699647, -0.18075634717941286, 0.0 ], "q99": [ 0.14956976801157001, 0.1805950567126275, 0.18841815620660796, 0.21615413755178453, 0.09457383215427405, 0.18543301910162005, 1.0 ], "std": [ 0.04935386776924133, 0.0635455846786499, 0.061164740473032, 0.09553450345993042, 0.08420111238956451, 0.06517903506755829, 0.49452081322669983 ] }, "num_trajectories": 1995, "num_transitions": 187507, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "stanford_hydra_dataset_converted_externally_to_rlds": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.02499854564666748, 0.02499903365969658, 0.024999922141432762, 0.24974457919597626, 0.24997030198574066, 0.24999946355819702, 1.0 ], "mean": [ 0.0007790001109242439, 0.00013707754260394722, -0.0002548607881180942, 0.0012903271708637476, -0.004751681815832853, 0.002692886395379901, 0.48855218291282654 ], "min": [ -0.024999044835567474, -0.024999700486660004, -0.02499929815530777, -0.24993225932121277, -0.2499666064977646, -0.2499932497739792, 0.0 ], "q01": [ -0.019992006458342076, -0.02415412735193968, -0.022941758055239916, -0.11085530579090118, -0.12024572037160397, -0.13314770206809043, 0.0 ], "q99": [ 0.022886231057345868, 0.022358838934451335, 0.02410089675337076, 0.12370114490389822, 0.11323311634361738, 0.18474749639630164, 1.0 ], "std": [ 0.008022161200642586, 0.009131459519267082, 0.009574338793754578, 0.04122216999530792, 0.0384303517639637, 0.04606688767671585, 0.49976691603660583 ] }, "num_trajectories": 570, "num_transitions": 358234, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "taco_play": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 1.4915844202041626, 2.1842432022094727, 2.6836395263671875, 5.035226821899414, 2.665864944458008, 4.250768661499023, 1.0 ], "mean": [ -0.003845922416076064, 0.009671456180512905, 0.012780580669641495, -0.005403771996498108, -0.009606587700545788, -0.002480733208358288, 0.4263913035392761 ], "min": [ -4.242457866668701, -3.192805051803589, -1.3371467590332031, -4.202683448791504, -2.6722638607025146, -3.3467135429382324, 0.0 ], "q01": [ -0.7106140398979186, -1.056944659948349, -0.5878450274467468, -0.7682853937149048, -0.7180147767066956, -1.5527938604354858, 0.0 ], "q99": [ 0.6482916426658629, 1.0051310062408447, 0.9480248689651489, 0.6926478147506714, 0.6351067513227462, 1.628010264635086, 1.0 ], "std": [ 0.23254038393497467, 0.36298269033432007, 0.28692901134490967, 0.2617705166339874, 0.2438892275094986, 0.5216503143310547, 0.4946896731853485 ] }, "num_trajectories": 3603, "num_transitions": 237798, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "toto": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 0.6839867234230042, 0.4454185664653778, 0.7984078526496887, 2.120781660079956, 1.371164321899414, 1.4118704795837402, 0.0 ], "mean": [ 0.38542115688323975, 0.007769413758069277, 0.3632740378379822, -0.6652036905288696, 0.1890396922826767, 0.03298724442720413, 0.0 ], "min": [ 0.09922284632921219, -0.5180193781852722, 0.13791072368621826, -2.635117530822754, -1.0734480619430542, -1.9282547235488892, 0.0 ], "q01": [ 0.1756722891330719, -0.3077590811252594, 0.235383919775486, -2.0908505964279174, -0.6191593289375306, -0.7488683319091797, 0.0 ], "q99": [ 0.6136963081359863, 0.33704194784164443, 0.6681221985816956, 0.7422861719131538, 0.7955395007133507, 0.740464625358582, 0.0 ], "std": [ 0.12211652100086212, 0.19378550350666046, 0.10178236663341522, 0.5725259184837341, 0.29884573817253113, 0.3259911835193634, 0.0 ] }, "num_trajectories": 1003, "num_transitions": 325699, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "ucsd_kitchen_dataset_converted_externally_to_rlds": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 678.0, 400.0, 507.0, 180.00001525878906, 6.000013828277588, 116.99998474121094, 1.0 ], "mean": [ 410.37567138671875, 116.9518814086914, 192.35032653808594, -121.22441864013672, -33.84893035888672, 50.016136169433594, 0.741813600063324 ], "min": [ 172.0, -166.0, -99.99999237060547, -180.00001525878906, -89.0, -96.00010681152344, 0.0 ], "q01": [ 200.00001052856445, -102.31004211425781, -94.99993370056153, -180.00001525878906, -88.00001525878906, -38.999977111816406, 0.0 ], "q99": [ 637.0, 368.30999999999995, 493.0, 180.00001525878906, 0.999983012676239, 105.00001525878906, 1.0 ], "std": [ 122.81494903564453, 108.8009033203125, 130.303466796875, 116.28205108642578, 27.621843338012695, 41.02094650268555, 0.43763357400894165 ] }, "num_trajectories": 150, "num_transitions": 3970, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "utaustin_mutex": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 1.0, 1.0, 1.0, 0.375, 0.375, 0.375, 1.0 ], "mean": [ 0.06176406890153885, -0.005005486309528351, 0.10216785222291946, -0.03314131125807762, 0.013895004987716675, -0.011317633092403412, 0.5038976669311523 ], "min": [ -1.0, -1.0, -1.0, -0.375, -0.375, -0.375, 0.0 ], "q01": [ -0.4285714328289032, -0.9800000190734863, -0.5571428537368774, -0.375, -0.15642857551574707, -0.335357129573822, 0.0 ], "q99": [ 0.5914285778999329, 0.9714285731315613, 1.0, 0.3278571367263794, 0.207857146859169, 0.25607141852378845, 1.0 ], "std": [ 0.1875014752149582, 0.4468473494052887, 0.3792876601219177, 0.14097853004932404, 0.06453701853752136, 0.11765272170305252, 0.501045286655426 ] }, "num_trajectories": 1500, "num_transitions": 361883, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } }, "viola": { "action": { "mask": [ true, true, true, true, true, true, false ], "max": [ 1.0, 1.0, 1.0, 0.375, 0.36321428418159485, 0.375, 1.0 ], "mean": [ 0.04761844128370285, -0.029204415157437325, 0.05586736649274826, -0.002618510741740465, 0.006867344491183758, -0.01682133786380291, 0.7323777675628662 ], "min": [ -1.0, -1.0, -1.0, -0.375, -0.375, -0.375, 0.0 ], "q01": [ -0.9628571271896362, -1.0, -1.0, -0.26249998807907104, -0.21321429312229156, -0.3385714292526245, 0.0 ], "q99": [ 0.9114285707473755, 0.868571400642395, 1.0, 0.2817857265472412, 0.2239285707473755, 0.3557142913341522, 1.0 ], "std": [ 0.39157867431640625, 0.4076525568962097, 0.40077948570251465, 0.10023996233940125, 0.0844319611787796, 0.10375042259693146, 0.44260647892951965 ] }, "num_trajectories": 150, "num_transitions": 76324, "proprio": { "max": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "mean": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "min": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q01": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "q99": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "std": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } } }, "output_projector_states": false, "pad_to_multiple_of": 64, "pad_token_id": 32000, "text_config": { "bos_token_id": 151643, "eos_token_id": 151643, "hidden_size": 896, "intermediate_size": 4864, "max_position_embeddings": 32768, "max_window_layers": 24, "model_type": "qwen2", "num_attention_heads": 14, "num_hidden_layers": 24, "num_key_value_heads": 2, "rope_theta": 1000000.0, "sliding_window": 32768, "tie_word_embeddings": true, "torch_dtype": "bfloat16", "use_mrope": false, "use_sliding_window": false, "vocab_size": 151936 }, "timm_model_ids": [ "vit_large_patch14_reg4_dinov2.lvd142m", "vit_so400m_patch14_siglip_224" ], "timm_override_act_layers": [ null, null ], "torch_dtype": "bfloat16", "transformers_version": "4.40.1", "use_fused_vision_backbone": true, "vision_backbone_id": "dinosiglip-vit-so-224px"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144"""configuration_prismatic.py
HuggingFace-style configuration definition for Prismatic VLMs, inheriting from `transformers.PretrainedConfig`.Default configuration specifies `siglip-224px+7b`."""
from typing import Any, Dict, List, Optional
from transformers import PretrainedConfigfrom transformers.models.auto import CONFIG_MAPPING
# === Utilities for Mapping Prismatic names to HF names ===# fmt: offVISION_BACKBONE_TO_RESOLUTION: Dict[str, List[int]] = { "clip-vit-l": [224], "siglip-vit-so400m": [224], "dinov2-vit-l": [224], "in1k-vit-l": [224],
"clip-vit-l-336px": [336], "siglip-vit-so400m-384px": [384],
"dinoclip-vit-l-336px": [336, 336], "dinosiglip-vit-so-224px": [224, 224], "dinosiglip-vit-so-384px": [384, 384],}VISION_BACKBONE_TO_TIMM_ID: Dict[str, List[str]] = { "clip-vit-l": ["vit_large_patch14_clip_224.openai"], "clip-vit-l-336px": ["vit_large_patch14_clip_336.openai"],
"dinov2-vit-l": ["vit_large_patch14_reg4_dinov2.lvd142m"], "in1k-vit-l": ["vit_large_patch16_224.augreg_in21k_ft_in1k"],
"siglip-vit-so400m": ["vit_so400m_patch14_siglip_224"], "siglip-vit-so400m-384px": ["vit_so400m_patch14_siglip_384"],
"dinoclip-vit-l-336px": ["vit_large_patch14_reg4_dinov2.lvd142m", "vit_large_patch14_clip_336.openai"], "dinosiglip-vit-so-224px": ["vit_large_patch14_reg4_dinov2.lvd142m", "vit_so400m_patch14_siglip_224"], "dinosiglip-vit-so-384px": ["vit_large_patch14_reg4_dinov2.lvd142m", "vit_so400m_patch14_siglip_384"],}TIMM_OVERRIDE_ACT_LAYER: Dict[str, List[Optional[str]]] = { "clip-vit-l": ["quick_gelu"], "clip-vit-l-336px": ["quick_gelu"], "dinov2-vit-l": [None], "in1k-vit-l": [None], "siglip-vit-so400m": [None], "siglip-vit-so400m-384px": [None], "dinoclip-vit-l-336px": [None, "quick_gelu"], "dinosiglip-vit-so-224px": [None, None], "dinosiglip-vit-so-384px": [None, None]}
LLM_BACKBONE_TO_HF_PATH = { "llama2-7b-pure": "meta-llama/Llama-2-7b-hf", "llama2-13b-pure": "meta-llama/Llama-2-13b-hf", "llama2-7b-chat": "meta-llama/Llama-2-7b-chat-hf", "llama2-13b-chat": "meta-llama/Llama-2-13b-chat-hf",
"vicuna-v15-7b": "lmsys/vicuna-7b-v1.5", "vicuna-v15-13b": "lmsys/vicuna-13b-v1.5",
"mistral-v0.1-7b-pure": "mistralai/Mistral-7B-v0.1", "mistral-v0.1-7b-instruct": "mistralai/Mistral-7B-Instruct-v0.1",
"phi-2-3b": "microsoft/phi-2", "qwen25-0_5b-extra": "Qwen/Qwen2.5-0.5B", "qwen25-0_5b-pure": "Qwen/Qwen2.5-0.5B"
}LLM_BACKBONE_TO_HF_METACLASS = { "llama2-7b-pure": "llama", "llama2-13b-pure": "llama", "llama2-7b-chat": "llama", "llama2-13b-chat": "llama", "vicuna-v15-7b": "llama", "vicuna-v15-13b": "llama",
"mistral-v0.1-7b-pure": "mistral", "mistral-v0.1-7b-instruct": "mistral",
"phi-2-3b": "phi", "qwen25-0_5b-extra": "qwen2" ,"qwen25-0_5b-pure": "qwen2" }
VALID_VISION_BACKBONES = set(VISION_BACKBONE_TO_RESOLUTION.keys())VALID_LLM_BACKBONES = set(LLM_BACKBONE_TO_HF_PATH)# fmt: on
class PrismaticConfig(PretrainedConfig): model_type: str = "prismatic" is_composition: bool = False
def __init__( self, vision_backbone_id: str = "siglip-vit-so400m", llm_backbone_id: str = "vicuna-v15-7b", arch_specifier: str = "no-align+gelu-mlp", use_fused_vision_backbone: Optional[bool] = None, image_resize_strategy: str = "letterbox", text_config: Optional[Dict[str, Any]] = None, llm_max_length: int = 2048, pad_token_id: int = 32000, pad_to_multiple_of: int = 64, output_projector_states: bool = False, **kwargs: str, ) -> None: if vision_backbone_id not in VALID_VISION_BACKBONES: raise ValueError(f"Vision backbone `{vision_backbone_id}` not in {VALID_VISION_BACKBONES = }")
if llm_backbone_id not in VALID_LLM_BACKBONES: raise ValueError(f"LLM backbone `{llm_backbone_id}` not in {VALID_LLM_BACKBONES = }")
# Set Prismatic Configuration Fields self.vision_backbone_id = vision_backbone_id self.llm_backbone_id = llm_backbone_id self.arch_specifier = arch_specifier self.output_projector_states = output_projector_states
# [Contract] All vision backbone parameters are lists =>> supports fused backbones with different preprocessing self.use_fused_vision_backbone = ( use_fused_vision_backbone if use_fused_vision_backbone is not None else any(self.vision_backbone_id.startswith(v) for v in ["dinoclip", "dinosiglip"]) )
self.timm_model_ids = VISION_BACKBONE_TO_TIMM_ID[self.vision_backbone_id] self.timm_override_act_layers = TIMM_OVERRIDE_ACT_LAYER[self.vision_backbone_id] self.image_sizes = VISION_BACKBONE_TO_RESOLUTION[self.vision_backbone_id] self.image_resize_strategy = image_resize_strategy
self.hf_llm_id = LLM_BACKBONE_TO_HF_PATH[self.llm_backbone_id] self.llm_max_length = llm_max_length self.pad_token_id, self.pad_to_multiple_of = pad_token_id, pad_to_multiple_of
# [IMPORTANT] HF Utilities actually look for a `text_config` field... we need to use that specific naming! self.text_config = ( CONFIG_MAPPING[LLM_BACKBONE_TO_HF_METACLASS[self.llm_backbone_id]](**text_config) if text_config is not None else CONFIG_MAPPING[LLM_BACKBONE_TO_HF_METACLASS[self.llm_backbone_id]]() )
# Dispatch **kwargs to super() =>> note that `pad_token_id` collides, so we pass it in here as well... super().__init__(pad_token_id=pad_token_id, **kwargs)
class OpenVLAConfig(PrismaticConfig): model_type: str = "openvla"
def __init__( self, norm_stats: Optional[Dict[str, Dict[str, Dict[str, Dict[str, List[float]]]]]] = None, n_action_bins: int = 256, **kwargs: str, ) -> None: self.norm_stats, self.n_action_bins = norm_stats, n_action_bins
super().__init__(**kwargs)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133{ "libero_spatial_no_noops": { "action": { "mean": [ 0.15312442183494568, 0.13707202672958374, -0.15526731312274933, -0.005176445469260216, -0.011208739131689072, -0.02019423432648182, 0.4578818082809448 ], "std": [ 0.4127272367477417, 0.3472447693347931, 0.5086907148361206, 0.037266116589307785, 0.07244451344013214, 0.05762419477105141, 0.4982806146144867 ], "max": [ 0.9375, 0.9375, 0.9375, 0.1971428543329239, 0.33642858266830444, 0.375, 1.0 ], "min": [ -0.9375, -0.9375, -0.9375, -0.1875, -0.3675000071525574, -0.36000001430511475, 0.0 ], "q01": [ -0.7454732114076613, -0.6616071462631226, -0.9375, -0.1071428582072258, -0.20678570866584778, -0.1842857152223587, 0.0 ], "q99": [ 0.9375, 0.8758928775787354, 0.9321428537368774, 0.1039285734295845, 0.17678570747375488, 0.14571428298950195, 1.0 ], "mask": [ true, true, true, true, true, true, false ] }, "proprio": { "mean": [ -0.024462517350912094, 0.10653048008680344, 1.0580538511276245, 3.0628459453582764, -0.10464031994342804, 0.08307308703660965, 0.01995464786887169, -0.02016282081604004 ], "std": [ 0.11014777421951294, 0.1378469467163086, 0.10442803055047989, 0.10451069474220276, 0.4112098217010498, 0.21766914427280426, 0.017260877415537834, 0.01711163856089115 ], "max": [ 0.1759040206670761, 0.3904820382595062, 1.3290715217590332, 3.4566118717193604, 1.2268599271774292, 1.0429412126541138, 0.041053611785173416, 0.000775813648942858 ], "min": [ -0.3095473051071167, -0.29250794649124146, 0.9095591306686401, 2.497488260269165, -1.8006486892700195, -0.7207611203193665, -0.0004703797458205372, -0.041536275297403336 ], "q01": [ -0.2727657300233841, -0.23721413239836692, 0.9160063165426254, 2.77949666261673, -1.3187511622905732, -0.41989982962608335, 0.001503719249740243, -0.03989770736545324 ], "q99": [ 0.13529365032911292, 0.3629165390133857, 1.2862326657772063, 3.2829698753356933, 0.9332760351896285, 0.6325724506378171, 0.039933966137468815, -0.001671919699292631 ] }, "num_transitions": 52970, "num_trajectories": 432 }}1234567{ "_from_model_config": true, "bos_token_id": 151643, "eos_token_id": 151643, "pad_token_id": 32000, "transformers_version": "4.40.1"}123version https://git-lfs.github.com/spec/v1oid sha256:15670174dd58dbec46c6945882018054f916b0ec6d8ec71b7c39409416aae02bsize 250523258412345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001"""modeling_prismatic.py
Core HuggingFace-style PrismaticPreTrainedModel and PrismaticForConditionalGeneration class definitions.Inherits from the default `transformers.PretrainedModel`. Meant to be standalone and self-contained,but exactly replicate the logic in `prismatic.models.vlms.prismatic.py`."""
import loggingfrom dataclasses import dataclassfrom functools import partialfrom typing import Any, Callable, ClassVar, Dict, List, Optional, Tuple, Unionimport numpy as npimport timmimport tokenizersimport torchimport torch.nn as nnimport transformersfrom timm.models.vision_transformer import LayerScalefrom transformers import AutoModelForCausalLM, PretrainedConfig, PreTrainedModelfrom transformers.modeling_outputs import ModelOutput
from prismatic.training.train_utils import ( get_current_action_mask, get_next_actions_mask,)from prismatic.vla.constants import ( ACTION_DIM, ACTION_PROPRIO_NORMALIZATION_TYPE, ACTION_TOKEN_BEGIN_IDX, IGNORE_INDEX, NUM_ACTIONS_CHUNK, STOP_INDEX, NormalizationType, NUM_TOKENS)from .configuration_prismatic import OpenVLAConfig, PrismaticConfig
# Set up loggerlogger = logging.getLogger(__name__)
# === Utility Functions for Monkey-Patching ===def unpack_tuple(fn: Callable[[Any], Tuple[Any]]) -> Callable[[Any], Any]: def wrapper(*args: Any, **kwargs: Any) -> Any: result = fn(*args, **kwargs) return result[0] if isinstance(result, tuple) else result
return wrapper
# HF Transformers overwrites parameters with names containing `gamma`; we're going to patch VisionBackbone.LayerScale.# =>> TIMM :: https://github.com/huggingface/pytorch-image-models/blob/main/timm/models/vision_transformer.py#L109# =>> Transformers :: https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_utils.py#L3960def _ls_new_forward(self, x: torch.Tensor) -> torch.Tensor: return x.mul_(self.scale_factor) if self.inplace else x * self.scale_factor
def ls_apply_patch(ls_module: LayerScale): ls_module.scale_factor = nn.Parameter(ls_module.gamma.clone()) ls_module.forward = _ls_new_forward.__get__(ls_module, LayerScale) del ls_module.gamma
# === Prismatic Vision Backbone (nn.Module) Definitions (w/ Fused Backbone Support) ===class PrismaticVisionBackbone(nn.Module): """ Vision backbone for Prismatic models that handles image feature extraction.
Supports both single backbone (e.g., SigLIP) and fused backbone (e.g., SigLIP + DINOv2) configurations. For fused backbones, features from both models are concatenated along the feature dimension. """
def __init__( self, use_fused_vision_backbone: bool, image_sizes: List[int], timm_model_ids: List[str], timm_override_act_layers: List[Optional[str]], ) -> None: """ Initialize the vision backbone.
Args: use_fused_vision_backbone: Whether to use two backbones and fuse their features image_sizes: List of image sizes for each backbone timm_model_ids: List of TIMM model IDs to use for each backbone timm_override_act_layers: List of activation layer overrides for each backbone """ super().__init__() self.use_fused_vision_backbone = use_fused_vision_backbone self.num_images_in_input = 1 # Default value, can be overridden later
# Validate number of (fused) vision backbones if len(timm_model_ids) > 2: raise ValueError("Prismatic models only support up to 2 (fused) vision backbones!")
# Create primary featurizer self.featurizer = self._create_featurizer( model_id=timm_model_ids[0], img_size=image_sizes[0], act_layer=timm_override_act_layers[0] ) self.embed_dim = self.featurizer.embed_dim
# Create secondary featurizer if using fused backbone if self.use_fused_vision_backbone: self.fused_featurizer = self._create_featurizer( model_id=timm_model_ids[1], img_size=image_sizes[1], act_layer=timm_override_act_layers[1] ) self.embed_dim += self.fused_featurizer.embed_dim
# Patch LayerScale modules for HF compatibility self._patch_layer_scales()
def _create_featurizer(self, model_id: str, img_size: int, act_layer: Optional[str]) -> nn.Module: """ Create a TIMM-based featurizer model with appropriate configurations.
Args: model_id: The TIMM model ID to load img_size: Input image size for the model act_layer: Override for the activation layer type
Returns: A configured featurizer model """ featurizer = timm.create_model( model_id, pretrained=False, num_classes=0, img_size=img_size, act_layer=act_layer, )
# Monkey-patch the forward function to extract the second-to-last layer features num_blocks = len(featurizer.blocks) featurizer.forward = unpack_tuple(partial(featurizer.get_intermediate_layers, n={num_blocks - 2}))
return featurizer
def _patch_layer_scales(self) -> None: """ Patch all LayerScale modules to be compatible with HF's parameter naming.
HF Transformers overwrites parameters with names containing 'gamma', so we need to rename and modify the forward method. """ # Patch primary featurizer for module in self.featurizer.modules(): if isinstance(module, LayerScale): ls_apply_patch(module)
# Patch secondary featurizer if it exists if self.use_fused_vision_backbone: for module in self.fused_featurizer.modules(): if isinstance(module, LayerScale): ls_apply_patch(module)
def get_num_patches(self) -> int: """ Returns the number of vision patches output by the vision backbone.
Returns: Number of patches per image """ return self.featurizer.patch_embed.num_patches
def get_num_images_in_input(self) -> int: """ Returns the number of input images for the vision backbone.
Returns: Number of images expected in the input """ return self.num_images_in_input
def set_num_images_in_input(self, num_images_in_input: int) -> None: """ Sets the number of input images for the vision backbone.
Args: num_images_in_input: Number of images to expect in the input """ self.num_images_in_input = num_images_in_input
def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: """ Implements the forward pass for the vision backbone.
If `self.use_fused_vision_backbone == True`, uses both SigLIP and DINOv2 transformers to extract visual features (otherwise uses SigLIP only). Allows multi-image inputs (but only for fused vision backbone).
Args: pixel_values (torch.Tensor): Pixels for input image(s), (B, C, H, W). """ if self.num_images_in_input == 1: if not self.use_fused_vision_backbone: return self.featurizer(pixel_values)
# Split `pixel_values :: [bsz, 2 * 3, resolution, resolution]` =>> featurize =>> channel stack img, img_fused = torch.split(pixel_values, [3, 3], dim=1) patches, patches_fused = self.featurizer(img), self.fused_featurizer(img_fused)
return torch.cat([patches, patches_fused], dim=2)
else: assert self.use_fused_vision_backbone, "Multi-image inputs require using fused backbone!"
# Split `pixel_values` into individual images (each with 6 channels: 3 for SigLIP + 3 for DINOv2) images = torch.split(pixel_values, [6] * self.num_images_in_input, dim=1)
# Process each image and collect patches all_patches = [] for img in images: # Split each image further into two stacks of channels (each with 3 channels) img_regular, img_fused = torch.split(img, [3, 3], dim=1)
# Get patches from both SigLIP and DINOv2 vision transformers patches = self.featurizer(img_regular) patches_fused = self.fused_featurizer(img_fused)
# Concatenate SigLIP and DINOv2 patches along the hidden dimension combined_patches = torch.cat([patches, patches_fused], dim=2) all_patches.append(combined_patches)
# Concatenate all patches along the patch dimension return torch.cat(all_patches, dim=1)
# === Prismatic Projector (nn.Module) Definitions ===class PrismaticProjector(nn.Module): def __init__(self, use_fused_vision_backbone: bool, vision_dim: int, llm_dim: int) -> None: super().__init__() self.use_fused_vision_backbone = use_fused_vision_backbone self.vision_dim, self.llm_dim = vision_dim, llm_dim
# Switch on `use_fused_vision_backbone` =>> use slightly different MLPs and projection factors! if not self.use_fused_vision_backbone: self.fc1 = nn.Linear(self.vision_dim, self.llm_dim, bias=True) self.fc2 = nn.Linear(self.llm_dim, self.llm_dim, bias=True) self.act_fn1 = nn.GELU() else: initial_projection_dim = 4 * vision_dim self.fc1 = nn.Linear(self.vision_dim, initial_projection_dim, bias=True) self.fc2 = nn.Linear(initial_projection_dim, self.llm_dim, bias=True) self.fc3 = nn.Linear(self.llm_dim, self.llm_dim, bias=True) self.act_fn1 = nn.GELU() self.act_fn2 = nn.GELU()
def forward(self, img_patches: torch.Tensor) -> torch.Tensor: if not self.use_fused_vision_backbone: projected_features = self.fc1(img_patches) projected_features = self.act_fn1(projected_features) projected_features = self.fc2(projected_features) else: projected_features = self.fc1(img_patches) projected_features = self.act_fn1(projected_features) projected_features = self.fc2(projected_features) projected_features = self.act_fn2(projected_features) projected_features = self.fc3(projected_features)
return projected_features
# === Main HF Class Definitions ===@dataclassclass PrismaticCausalLMOutputWithPast(ModelOutput): """Base class for Prismatic casual (visually-conditioned) language model outputs; also exposes visual features."""
loss: Optional[torch.FloatTensor] = None logits: torch.FloatTensor = None past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None hidden_states: Optional[Tuple[torch.FloatTensor, ...]] = None attentions: Optional[Tuple[torch.FloatTensor]] = None
# Additions for VLMs projector_features: Optional[torch.FloatTensor] = None
class PrismaticPreTrainedModel(PreTrainedModel): config_class: PretrainedConfig = PrismaticConfig base_model_prefix: str = "model" supports_gradient_checkpointing: bool = True
_no_split_modules: ClassVar[List[str]] = ["PrismaticProjector"] _skip_keys_device_placement: str = "past_key_values" _supports_flash_attn_2: bool = True
def _init_weights(self, module: nn.Module) -> None: # Important :: this HF ported version is *not* meant for training from scratch; only inference and fine-tuning! # => As such, this init_weights code is not correct; if training VLMs from scratch, use the main codebase at # https://github.com/TRI-ML/prismatic-vlms std = ( self.config.initializer_range if hasattr(self.config, "initializer_range") else self.config.text_config.initializer_range )
if hasattr(module, "class_embedding"): module.class_embedding.data.normal_(mean=0.0, std=std)
if isinstance(module, (nn.Linear, nn.Conv2d)): module.weight.data.normal_(mean=0.0, std=std) if module.bias is not None: module.bias.data.zero_() elif isinstance(module, nn.Embedding): module.weight.data.normal_(mean=0.0, std=std) if module.padding_idx is not None: module.weight.data[module.padding_idx].zero_()
@property def _supports_sdpa(self) -> bool: """Check LLM supports SDPA Attention""" return self.language_model._supports_sdpa
class PrismaticForConditionalGeneration(PrismaticPreTrainedModel): def __init__(self, config: PrismaticConfig) -> None: super().__init__(config)
# [Validation] Lightweight Validate on `config` Fields + Dependency Versions if config.use_fused_vision_backbone is None: raise ValueError("Missing config field `use_fused_vision_backbone`")
if timm.__version__ not in {"0.9.10", "0.9.11", "0.9.12", "0.9.16"}: raise NotImplementedError( "TIMM Version must be >= 0.9.10 and < 1.0.0 (breaking); please raise a GitHub Issue " "if you urgently need support for latest TIMM versions." )
if (transformers.__version__ != "4.40.1") or (tokenizers.__version__ != "0.19.1"): logger.warning( f"Expected `transformers==4.40.1` and `tokenizers==0.19.1` but got " f"`transformers=={transformers.__version__}` and `tokenizers=={tokenizers.__version__}`; " f"there might be inference-time regressions due to dependency changes. If in doubt, please" f"use the above versions." ) # Instantiate PrismaticVisionBackbone (w/ Potential Fused Backbone) self.vision_backbone = PrismaticVisionBackbone( config.use_fused_vision_backbone, config.image_sizes, config.timm_model_ids, config.timm_override_act_layers )
# Create Multimodal Projector self.projector = PrismaticProjector( config.use_fused_vision_backbone, vision_dim=self.vision_backbone.embed_dim, llm_dim=config.text_config.hidden_size, )
# Instantiate LLM Backbone self.language_model = AutoModelForCausalLM.from_config( config.text_config, attn_implementation=config._attn_implementation )
self.vocab_size = config.text_config.vocab_size self.pad_token_id = config.pad_token_id self.llm_dim = config.text_config.hidden_size #Action query token self.action_queries = nn.Embedding(NUM_TOKENS, self.llm_dim) self.action_queries.weight.data.zero_()
# HF Boilerplate =>> initializes weights via `_init_weights()` and sets gradient checkpointing self.post_init()
# === `PreTrainedModel` Boilerplate === def get_input_embeddings(self) -> nn.Module: return self.language_model.get_input_embeddings() def set_version(self, version: str): self.version = version return self.version
def set_input_embeddings(self, value: nn.Module) -> None: self.language_model.set_input_embeddings(value)
def get_output_embeddings(self) -> nn.Module: return self.language_model.get_output_embeddings()
def set_output_embeddings(self, new_embeddings: nn.Module) -> None: self.language_model.set_output_embeddings(new_embeddings)
def get_decoder(self) -> nn.Module: return self.language_model.get_decoder()
def set_decoder(self, decoder: nn.Module) -> None: self.language_model.set_decoder(decoder)
def tie_weights(self) -> None: self.language_model.tie_weights() # Note: `Llama-2` and `Mistral` don't tie weights (no-op)
def resize_token_embeddings( self, new_num_tokens: Optional[int] = None, pad_to_multiple_of: Optional[int] = None ) -> nn.Embedding: updated_embeddings = self.language_model.resize_token_embeddings(new_num_tokens, pad_to_multiple_of)
# Update config/instance variables self.config.text_config.vocab_size = updated_embeddings.num_embeddings self.vocab_size = updated_embeddings.num_embeddings
return updated_embeddings
def _replace_input_embeddings(self, input_embeddings, all_actions_mask, noisy_action_features): """ Replace embeddings in input_embeddings at positions where all_actions_mask is True with embeddings from noisy_action_features, using vectorized operations.
Args: input_embeddings: Tensor of shape (B, S, D) all_actions_mask: Boolean tensor of shape (B, S) noisy_action_features: Tensor of shape (B, K, D) where K is the number of True values in mask per sample
Returns: Modified input_embeddings tensor """ # Clone input to avoid modifying the original tensor new_input_embeddings = input_embeddings.clone()
# Create a tensor with the same shape of input_embeddings to hold the noisy action features repositioned_noisy_action_features = torch.zeros_like(input_embeddings)
# Create batch indices for splicing batch_indices = torch.arange(input_embeddings.shape[0], device=input_embeddings.device) batch_indices = batch_indices.unsqueeze(1).expand(-1, noisy_action_features.shape[1])
# Get indices where mask is True for each sample masked_indices = torch.stack([torch.where(mask)[0] for mask in all_actions_mask])
# Move the noisy action features into their correct positions # print(noisy_action_features.size()) repositioned_noisy_action_features[batch_indices, masked_indices] = noisy_action_features
# Combine original input embeddings and noisy action embeddings using the mask new_input_embeddings = torch.where( all_actions_mask.unsqueeze(-1), repositioned_noisy_action_features, new_input_embeddings )
return new_input_embeddings
def _process_action_masks(self, labels): """Helper to get action masks from labels""" current_action_mask = get_current_action_mask(labels) next_actions_mask = get_next_actions_mask(labels) all_actions_mask = current_action_mask | next_actions_mask # (B, seq_len) return all_actions_mask
def _process_vision_features(self, pixel_values, language_embeddings=None, use_film=False): """Process vision features with optional FiLM conditioning""" if use_film: # FiLM: Infuse language inputs into visual features patch_features = self.vision_backbone(pixel_values, language_embeddings) # (bsz, 256 * num_images, D) else: patch_features = self.vision_backbone(pixel_values) # (bsz, 256 * num_images, D)
# Project patch embeddings into language embedding space return self.projector(patch_features)
def _process_proprio_features(self, projected_patch_embeddings, proprio, proprio_projector): """Process proprioceptive features and append to vision features""" if proprio_projector is not None and proprio is not None: # projected_patch_embeddings: (bsz, num_patches * num_images, llm_dim) # proprio: (bsz, proprio_dim) or (propro_dim,) proprio = proprio.reshape(projected_patch_embeddings.shape[0], -1) # (bsz, proprio_dim) proprio_features = proprio_projector(proprio) # (bsz, llm_dim) proprio_features = proprio_features.unsqueeze(dim=1) # (bsz, 1, llm_dim) # For simplicity, just append proprio token to the end of projected vision patch tokens return torch.cat((projected_patch_embeddings, proprio_features), dim=1) return projected_patch_embeddings
def _build_multimodal_attention(self, input_embeddings, projected_patch_embeddings, attention_mask): """Build multimodal embeddings and attention mask""" # Update attention mask projected_patch_attention_mask = None if attention_mask is not None: projected_patch_attention_mask = torch.full( (projected_patch_embeddings.shape[0], projected_patch_embeddings.shape[1]), fill_value=True, dtype=attention_mask.dtype, device=attention_mask.device, )
# Build multimodal embeddings & attention mask; insert embeddings after <BOS> token (1:) multimodal_embeddings = torch.cat( [input_embeddings[:, :1, :], projected_patch_embeddings, input_embeddings[:, 1:, :]], dim=1 )
multimodal_attention_mask = None if attention_mask is not None: multimodal_attention_mask = torch.cat( [attention_mask[:, :1], projected_patch_attention_mask, attention_mask[:, 1:]], dim=1 )
return multimodal_embeddings, multimodal_attention_mask
def _build_multimodal_labels(self, labels, projected_patch_embeddings): """Build multimodal labels with IGNORE_INDEX for patch embeddings""" if labels is not None: projected_patch_labels = torch.full( (projected_patch_embeddings.shape[0], projected_patch_embeddings.shape[1]), fill_value=IGNORE_INDEX, dtype=labels.dtype, device=labels.device, ) return torch.cat([labels[:, :1], projected_patch_labels, labels[:, 1:]], dim=1) return None
# === Core Prismatic VLM `forward()` Logic === def forward( self, input_ids: Optional[torch.LongTensor] = None, attention_mask: Optional[torch.Tensor] = None, pixel_values: Optional[torch.FloatTensor] = None, labels: Optional[torch.LongTensor] = None, inputs_embeds: Optional[torch.FloatTensor] = None, past_key_values: Optional[List[torch.FloatTensor]] = None, use_cache: Optional[bool] = None, output_attentions: Optional[bool] = None, output_hidden_states: Optional[bool] = None, output_projector_features: Optional[bool] = None, return_dict: Optional[bool] = None, proprio=None, proprio_projector=None, noisy_actions=None, noisy_action_projector=None, diffusion_timestep_embeddings=None, use_film: bool = False, ) -> Union[Tuple, PrismaticCausalLMOutputWithPast]: """Run a forward pass through the VLM, returning a PrismaticCausalLMOutputWithPast instance.""" output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions output_hidden_states = ( output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states ) output_projector_features = output_projector_features if output_projector_features is not None else False return_dict = return_dict if return_dict is not None else self.config.use_return_dict
# Respect `use_cache` only if not training (even if `gradient_checkpointing` is off) use_cache = use_cache and not self.training
# Instantiate Placeholder for Projector Features projected_patch_embeddings = None
# === Handle Generation with Cache (`input_ids.shape[1] == 1`) =>> requires `past_keys_values` === if input_ids.shape[1] == 1: assert input_ids.shape[0] == 1, "Generation is only currently supported for batch size of 1!" assert past_key_values is not None, "You must provide `past_key_values` during cached generation!" assert labels is None, "Unexpected key `labels` provided during cached generation!"
language_model_output = self.language_model( input_ids=input_ids, attention_mask=None, position_ids=None, past_key_values=past_key_values, inputs_embeds=None, labels=None, use_cache=use_cache, output_attentions=output_attentions, output_hidden_states=output_hidden_states, return_dict=return_dict, )
# === Handle Unimodal Forward === elif pixel_values is None: assert (input_ids is not None) and (inputs_embeds is None), "Missing `input_ids` in language-only forward!" assert past_key_values is None, "Unexpected key `past_key_values` provided during language-only forward!"
language_model_output = self.language_model( input_ids=input_ids, attention_mask=attention_mask, position_ids=None, past_key_values=None, inputs_embeds=None, labels=labels, use_cache=use_cache, output_attentions=output_attentions, output_hidden_states=output_hidden_states, return_dict=return_dict, )
# === Handle Multimodal Forward === elif (input_ids.shape[0] == pixel_values.shape[0]) or (inputs_embeds.shape[0] == pixel_values.shape[0]): assert past_key_values is None, "Unexpected key `past_key_values` provided during multimodal forward!"
# Get input embeddings (from language model embeddings) input_embeddings = self.get_input_embeddings()(input_ids) # (B, seq_len, D)
# Extract action masks all_actions_mask = self._process_action_masks(labels)
# Extract the language portion of the input embeddings (i.e. remove the action tokens portion) # print(input_embeddings[~all_actions_mask].size()) language_embeddings = input_embeddings[~all_actions_mask].reshape( input_embeddings.shape[0], -1, input_embeddings.shape[2] ) # (B, lang_seq_len, llm_dim)
# Get visual features projected_patch_embeddings = self._process_vision_features(pixel_values, language_embeddings, use_film)
# Process action embeddings if noisy_actions is not None:
action_queries = self.action_queries.weight # (1, h) action_queries = action_queries.view(1, action_queries.shape[0], action_queries.shape[1]).repeat(input_embeddings.shape[0], 1, 1) # (b, chunk_size, h) all_actions_mask = self._process_action_masks(labels) input_embeddings = self._replace_input_embeddings( input_embeddings, all_actions_mask, action_queries)
else: action_queries = self.action_queries.weight # (1, h) action_queries = action_queries.view(1, action_queries.shape[0], action_queries.shape[1]).repeat(input_embeddings.shape[0], 1, 1) # (b, chunk_size, h) all_actions_mask = self._process_action_masks(labels) input_embeddings = self._replace_input_embeddings( input_embeddings, all_actions_mask, action_queries)
# Build multimodal embeddings & attention mask multimodal_embeddings, multimodal_attention_mask = self._build_multimodal_attention( input_embeddings, projected_patch_embeddings, attention_mask ) # Build labels for multimodal sequence if needed multimodal_labels = self._build_multimodal_labels(labels, projected_patch_embeddings)
# Dispatch to language model language_model_output = self.language_model( input_ids=None, attention_mask=multimodal_attention_mask, position_ids=None, past_key_values=None, inputs_embeds=multimodal_embeddings, labels=None, use_cache=use_cache, output_attentions=output_attentions, output_hidden_states=output_hidden_states, return_dict=return_dict, )
# === Otherwise =>> Assume Invalid! === elif (input_ids.shape[0] != pixel_values.shape[0]) or (inputs_embeds.shape[0] != pixel_values.shape[0]): raise ValueError("Non-homogenous batch of (text, image) input -- forward() does not support mixed batches!")
else: raise ValueError( "Invalid PrismaticForConditionalGeneration `forward()` call with provided arguments:\n" f"=> `input_ids` = {input_ids is not None}\n" f"=> `attention_mask` = {attention_mask is not None}\n" f"=> `pixel_values` = {pixel_values is not None}\n" f"=> `labels` = {labels is not None}\n" f"=> `input_embeds` = {inputs_embeds is not None}\n" f"=> `past_key_values` = {past_key_values is not None}\n" f"=> `use_cache` = {use_cache}" )
# Unpack `language_model_output` and return PrismaticCausalLMOutputWithPast (or tuple if not `return_dict`) if not return_dict: if output_projector_features and (projected_patch_embeddings is not None): return *language_model_output, projected_patch_embeddings
return language_model_output
return PrismaticCausalLMOutputWithPast( loss=language_model_output.loss, past_key_values=language_model_output.past_key_values, hidden_states=language_model_output.hidden_states, attentions=language_model_output.attentions, projector_features=projected_patch_embeddings, )
# === GenerationMixin Methods === def prepare_inputs_for_generation( self, input_ids: Optional[torch.Tensor] = None, past_key_values: Optional[List[torch.FloatTensor]] = None, inputs_embeds: Optional[torch.FloatTensor] = None, pixel_values: Optional[torch.FloatTensor] = None, attention_mask: Optional[torch.Tensor] = None, **kwargs: str, ) -> Dict[str, torch.Tensor]: """Borrowed from `LlamaForCausalLM` and simplified for batch size = 1; mirrors original PrismaticVLM logic.""" if ((input_ids is not None) and (input_ids.shape[0] > 1)) or ( (inputs_embeds is not None) and (inputs_embeds.shape[0] > 1) ): raise ValueError("Generation with batch size > 1 is not currently supported!")
# Handle `past_key_values` (cache) =>> assume `input_ids` just has unprocessed tokens if past_key_values is not None: input_ids = input_ids[:, -1:]
# If `input_embeds` are passed, we only want to use them in the 1st generation step if inputs_embeds is not None and past_key_values is None: model_inputs = {"input_embeds": inputs_embeds} else: model_inputs = {"input_ids": input_ids}
# Make sure `pixel_values` are preserved in `model_inputs` model_inputs.update( { "attention_mask": attention_mask, "pixel_values": pixel_values, "past_key_values": past_key_values, "use_cache": kwargs.get("use_cache"), } )
return model_inputs
# Defer to Language Model (all handle this differently, with different return types) def _reorder_cache(self, *args, **kwargs) -> Any: return self.language_model._reorder_cache(*args, **kwargs)
class OpenVLAForActionPrediction(PrismaticForConditionalGeneration): config_class: PretrainedConfig = OpenVLAConfig
def __init__(self, config: OpenVLAConfig) -> None: super().__init__(config) self.norm_stats = config.norm_stats
# Compute action bins self.bins = np.linspace(-1, 1, config.n_action_bins) self.bin_centers = (self.bins[:-1] + self.bins[1:]) / 2.0
# Compute vocab size for de-tokenization -- revert added "multiple of" self.vocab_size = self.config.text_config.vocab_size - self.config.pad_to_multiple_of
def _prepare_input_for_action_prediction(self, input_ids, attention_mask): """Prepares input for action prediction by adding necessary tokens""" # Add (ACTION_DIM * NUM_ACTIONS_CHUNK) placeholder tokens to input_ids to simulate action tokens placeholder_action_token_ids = ( torch.ones((input_ids.shape[0], NUM_TOKENS)).to(input_ids.device).to(input_ids.dtype) ) input_ids = torch.cat([input_ids, placeholder_action_token_ids], dim=-1)
# Add stop token to sequence (needed in non-causal bi-directional self-attention, as it appears at train time) stop_token_id = torch.ones((input_ids.shape[0], 1)).to(input_ids.device).to(input_ids.dtype) * STOP_INDEX input_ids = torch.cat([input_ids, stop_token_id], dim=-1)
# Extend the attention mask to fit the new shape of input # Note: Only batch size == 1 supported right now mask_extension = ( torch.ones((attention_mask.shape[0], input_ids.shape[-1] - attention_mask.shape[-1])) .to(attention_mask.device) .to(attention_mask.dtype) ) attention_mask = torch.cat([attention_mask, mask_extension], dim=-1)
return input_ids, attention_mask
def _prepare_labels_for_action_prediction(self, labels, input_ids): """Creates labels tensor for action prediction if not provided""" # Extend labels tensor with fake action labels ARBITRARY_ACTION_TOKEN_IDX = ACTION_TOKEN_BEGIN_IDX + 1 labels_extension = ( torch.ones((labels.shape[0], input_ids.shape[-1] - labels.shape[-1])).to(labels.device).to(labels.dtype) * ARBITRARY_ACTION_TOKEN_IDX ) labels = torch.cat([labels, labels_extension], dim=-1)
# Replace last label token with stop token labels[:, -1] = STOP_INDEX
return labels
def _unnormalize_actions(self, normalized_actions, unnorm_key=None): """Unnormalize actions using dataset statistics""" action_norm_stats = self.get_action_stats(unnorm_key)
if ACTION_PROPRIO_NORMALIZATION_TYPE == NormalizationType.BOUNDS: mask = action_norm_stats.get("mask", np.ones_like(action_norm_stats["min"], dtype=bool)) action_high, action_low = np.array(action_norm_stats["max"]), np.array(action_norm_stats["min"]) elif ACTION_PROPRIO_NORMALIZATION_TYPE == NormalizationType.BOUNDS_Q99: mask = action_norm_stats.get("mask", np.ones_like(action_norm_stats["q01"], dtype=bool)) action_high, action_low = np.array(action_norm_stats["q99"]), np.array(action_norm_stats["q01"]) else: raise ValueError("Unsupported action/proprio normalization type detected!")
actions = np.where( mask, 0.5 * (normalized_actions + 1) * (action_high - action_low + 1e-8) + action_low, normalized_actions, )
return actions
def _regression_or_discrete_prediction( self, input_embeddings, all_actions_mask, projected_patch_embeddings, attention_mask, labels, NUM_PATCHES, NUM_PROMPT_TOKENS, action_head=None, proprio=None, proprio_projector=None, ): """Run L1 regression-based continuous action prediction or discrete action tokens prediction."""
action_queries = self.action_queries.weight # (1, h) action_queries = action_queries.view(1, action_queries.shape[0], action_queries.shape[1]).repeat(input_embeddings.shape[0], 1, 1) # (b, chunk_size, h) # Replace action token embeddings with noisy action embeddings input_embeddings = self._replace_input_embeddings(input_embeddings.clone(), all_actions_mask, action_queries)
# Build multimodal embeddings and attention mask multimodal_embeddings, multimodal_attention_mask = self._build_multimodal_attention( input_embeddings, projected_patch_embeddings, attention_mask )
# Forward pass through language model language_model_output = self.language_model( input_ids=None, attention_mask=multimodal_attention_mask, position_ids=None, past_key_values=None, inputs_embeds=multimodal_embeddings, labels=None, use_cache=None, output_attentions=False, output_hidden_states=True, return_dict=True, )
# Extract hidden states for action tokens multi_layer_hidden_states = [] for item in language_model_output.hidden_states[0:]: # last_hidden_states = output.hidden_states[-1] # (B, seq_len, D) # Get hidden states for text portion of prompt+response (after the vision patches) text_hidden_states = item # Get hidden states for action portion of response actions_hidden_states = text_hidden_states[:, NUM_PATCHES+ NUM_PROMPT_TOKENS : NUM_PATCHES + NUM_PROMPT_TOKENS + NUM_TOKENS, :,].reshape(1, 1, NUM_TOKENS, -1).to(torch.bfloat16) batch_size = item.shape[0] task_latten_states = item[:, :NUM_PATCHES].reshape(batch_size, 1, NUM_PATCHES , -1) all_hidden_states = torch.cat((task_latten_states, actions_hidden_states),2) multi_layer_hidden_states.append(all_hidden_states) multi_layer_hidden_states = torch.cat(multi_layer_hidden_states, dim = 1)
# Handle different prediction methods if action_head is not None: # L1 regression prediction normalized_actions = action_head.predict_action(multi_layer_hidden_states, proprio=proprio, proprio_projector=proprio_projector) normalized_actions = normalized_actions.reshape(NUM_ACTIONS_CHUNK, ACTION_DIM) normalized_actions = normalized_actions.float().cpu().detach().numpy() else: # Discrete token-based prediction predicted_action_token_ids = ( language_model_output.logits[ :, NUM_PATCHES + NUM_PROMPT_TOKENS : NUM_PATCHES + NUM_PROMPT_TOKENS + ACTION_DIM * NUM_ACTIONS_CHUNK, ] .argmax(dim=2) .cpu() .numpy() ) discretized_actions = self.vocab_size - predicted_action_token_ids discretized_actions = np.clip(discretized_actions - 1, a_min=0, a_max=self.bin_centers.shape[0] - 1) normalized_actions = self.bin_centers[discretized_actions] normalized_actions = normalized_actions.reshape(NUM_ACTIONS_CHUNK, ACTION_DIM)
return normalized_actions, actions_hidden_states
def predict_action( self, input_ids: Optional[torch.LongTensor] = None, unnorm_key: Optional[str] = None, proprio=None, proprio_projector=None, action_head=None, noisy_action_projector=None, use_film: bool = False, **kwargs: str, ) -> np.ndarray: """Predict actions from input sequence, with options for different prediction methods.
Args: input_ids: Input token ids unnorm_key: Key for unnormalization statistics proprio: Proprioceptive features proprio_projector: Projector for proprioceptive features action_head: Optional head for L1 regression or diffusion-based prediction noisy_action_projector: Projector for noisy actions in diffusion-based prediction use_film: Whether to use FiLM conditioning **kwargs: Additional arguments including pixel_values and attention_mask
Returns: Tuple of (unnormalized_actions, action_hidden_states) """
pixel_values = kwargs["pixel_values"] # [1, 12, 224, 224] attention_mask = kwargs["attention_mask"] #
# Create fake labels tensor (needed for action mask) labels = input_ids.clone() labels[:] = IGNORE_INDEX
# Get number of tokens in prompt (excluding the start token) NUM_PROMPT_TOKENS = input_ids.shape[-1] - 1 # Subtract action tokens and stop token
# Prepare inputs by adding necessary tokens input_ids, attention_mask = self._prepare_input_for_action_prediction(input_ids, attention_mask)
# Update labels tensor for action mask computation later labels = self._prepare_labels_for_action_prediction(labels, input_ids)
# Get input embeddings and action masks input_embeddings = self.get_input_embeddings()(input_ids) all_actions_mask = self._process_action_masks(labels)
# Extract language embeddings language_embeddings = input_embeddings[~all_actions_mask].reshape( input_embeddings.shape[0], -1, input_embeddings.shape[2] )
# Process vision features projected_patch_embeddings = self._process_vision_features(pixel_values, language_embeddings, use_film)
# Add proprioceptive features if provided use_proprio = proprio_projector is not None and proprio is not None if use_proprio: proprio = torch.Tensor(proprio).to(projected_patch_embeddings.device, dtype=projected_patch_embeddings.dtype)
# Calculate number of patches (including proprio token and/or diffusion timestep embedding if present) NUM_PATCHES = self.vision_backbone.get_num_patches() * self.vision_backbone.get_num_images_in_input()
# Run regression or discrete token-based prediction normalized_actions, actions_hidden_states = self._regression_or_discrete_prediction( input_embeddings, all_actions_mask, projected_patch_embeddings, attention_mask, labels, NUM_PATCHES, NUM_PROMPT_TOKENS, action_head=action_head, proprio=proprio, # [8] proprio_projector=proprio_projector, ) # Unnormalize predicted actions actions = self._unnormalize_actions(normalized_actions, unnorm_key)
return actions, actions_hidden_states
@staticmethod def _check_unnorm_key(norm_stats: Dict[str, Dict[str, Any]], unnorm_key: Optional[str]) -> str: """Validate and resolve the unnormalization key for action statistics""" if unnorm_key is None: assert len(norm_stats) == 1, ( f"Your model was trained on more than one dataset, " f"please pass a `unnorm_key` from the following options to choose the statistics " f"used for un-normalizing actions: {norm_stats.keys()}" ) unnorm_key = next(iter(norm_stats.keys()))
assert unnorm_key in norm_stats, ( f"The `unnorm_key` you chose is not in the set of available dataset statistics, " f"please choose from: {norm_stats.keys()}" ) return unnorm_key
def get_action_dim(self, unnorm_key: Optional[str] = None) -> int: """Get the dimensionality of the policy's action space.""" unnorm_key = self._check_unnorm_key(self.norm_stats, unnorm_key) return len(self.norm_stats[unnorm_key]["action"]["min"])
def get_action_stats(self, unnorm_key: Optional[str] = None) -> Dict[str, Any]: """Get all the logged statistics for the given dataset.""" unnorm_key = self._check_unnorm_key(self.norm_stats, unnorm_key) return self.norm_stats[unnorm_key]["action"]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114{ "auto_map": { "AutoImageProcessor": "processing_prismatic.PrismaticImageProcessor", "AutoProcessor": "processing_prismatic.PrismaticProcessor" }, "image_processor_type": "PrismaticImageProcessor", "image_resize_strategy": "resize-naive", "input_sizes": [ [ 3, 224, 224 ], [ 3, 224, 224 ] ], "interpolations": [ "bicubic", "bicubic" ], "means": [ [ 0.485, 0.456, 0.406 ], [ 0.5, 0.5, 0.5 ] ], "processor_class": "PrismaticProcessor", "stds": [ [ 0.229, 0.224, 0.225 ], [ 0.5, 0.5, 0.5 ] ], "tvf_crop_params": [ { "output_size": [ 224, 224 ] }, { "output_size": [ 224, 224 ] } ], "tvf_do_letterbox": false, "tvf_letterbox_fill": null, "tvf_normalize_params": [ { "inplace": false, "mean": [ 0.484375, 0.455078125, 0.40625 ], "std": [ 0.228515625, 0.2236328125, 0.224609375 ] }, { "inplace": false, "mean": [ 0.5, 0.5, 0.5 ], "std": [ 0.5, 0.5, 0.5 ] } ], "tvf_resize_params": [ { "antialias": true, "interpolation": 3, "max_size": null, "size": [ 224, 224 ] }, { "antialias": true, "interpolation": 3, "max_size": null, "size": [ 224, 224 ] } ], "use_fused_vision_backbone": true}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252"""processing_prismatic.py
HuggingFace-style preprocessor definitions for Prismatic VLMs, inheriting from `ProcessorMixin`. Default configurationspecifies `siglip-224px+7b`."""
from typing import Any, ClassVar, List, Optional, Tuple, Union
import timm.dataimport torchimport torchvision.transforms.functional as TVFfrom PIL import Imagefrom torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensorfrom transformers import PreTrainedTokenizerBasefrom transformers.image_processing_utils import BatchFeature, ImageProcessingMixinfrom transformers.processing_utils import ProcessorMixinfrom transformers.tokenization_utils import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategyfrom transformers.utils import TensorType
# === Image Processing ===def letterbox_pad_transform(image: Image.Image, padding_fill_value: Tuple[int, int, int]) -> Image.Image: """Given a PIL.Image, pad to square by adding a symmetric border around the height/width.""" (w, h), max_wh = image.size, max(image.size) horizontal_pad, vertical_pad = int((max_wh - w) / 2), int((max_wh - h) / 2) padding = (horizontal_pad, vertical_pad, horizontal_pad, vertical_pad)
return TVF.pad(image, padding, fill=padding_fill_value, padding_mode="constant")
class PrismaticImageProcessor(ImageProcessingMixin): model_input_names: ClassVar[List[str]] = ["pixel_values"]
def __init__( self, use_fused_vision_backbone: bool = False, image_resize_strategy: str = "letterbox", input_sizes: Optional[List[Tuple[int, int, int]]] = None, interpolations: Optional[List[str]] = None, means: Optional[List[Tuple[float, float, float]]] = None, stds: Optional[List[Tuple[float, float, float]]] = None, **kwargs: str, ) -> None: """ Initialize a PrismaticImageProcessor as a wrapper around a torchvision transform; this transform will be created by TIMM, and edited to follow our custom `image_resize_strategy` logic. @param use_fused_vision_backbone: Boolean indicating single or fused (dual) vision backbone @param image_resize_strategy: Prismatic image resize strategy in < resize-naive | resize-crop | letterbox > @param input_size: [TIMM :: `data_cfg`] Input image size as tuple (channels, width, height) @param interpolation: [TIMM :: `data_cfg`] Interpolation as string (default: "bicubic") @param mean: [TIMM :: `data_cfg`] Normalization mean as float tuple (or two-tuple if `fused_backbone`) @param std: [TIMM :: `data_cfg`] Normalization std as float tuple (or two-tuple if `fused_backbone`) """ self.use_fused_vision_backbone = use_fused_vision_backbone self.image_resize_strategy = image_resize_strategy
# Handle `None` default values input_sizes = [(3, 224, 224)] if input_sizes is None else input_sizes means = [(0.5, 0.5, 0.5)] if means is None else means stds = [(0.5, 0.5, 0.5)] if stds is None else stds
# TIMM `data_cfg` Parameters self.input_sizes, self.interpolations, self.means, self.stds = input_sizes, interpolations, means, stds
# Grab torchvision transforms via TIMM =>> need to parse for specific "functional" transform values! self.tvf_resize_params, self.tvf_crop_params, self.tvf_normalize_params = [], [], [] self.tvf_do_letterbox, self.tvf_letterbox_fill = False, None
for idx in range(len(input_sizes)): transform = timm.data.create_transform( input_size=self.input_sizes[idx], interpolation=self.interpolations[idx], mean=self.means[idx], std=self.stds[idx], crop_pct=1.0, # Set to 1.0 to ignore cropping (initial Resize sets `input_size`) crop_mode="center", # Default crop mode -- no-op when `crop_pct == 1.0` is_training=False, # No image augmentations when loading the transform! )
# [Validation] Ensure appropriate transform structure, expected sizes if not ( isinstance(transform, Compose) and (len(transform.transforms) == 4) and isinstance(transform.transforms[0], Resize) and isinstance(transform.transforms[1], CenterCrop) and isinstance(transform.transforms[2], ToTensor) and isinstance(transform.transforms[3], Normalize) and (transform.transforms[0].size == self.input_sizes[idx][-1]) and (transform.transforms[1].size == self.input_sizes[idx][-2:]) ): raise ValueError(f"Unexpected TIMM image transformation structure/sizes: `{transform}`")
# HF Image Processors *must* be JSON-serializable; as such, cannot have torchvision. as an attribute. # => Instead, we're going to parse the transform and call "torchvision.transforms.functional" (`tvf`) resize_t, crop_t, norm_t = transform.transforms[0], transform.transforms[1], transform.transforms[3] self.tvf_resize_params.append( { "size": resize_t.size, "interpolation": TVF.pil_modes_mapping[resize_t.interpolation], "max_size": None, "antialias": True, } ) self.tvf_crop_params.append({"output_size": crop_t.size}) self.tvf_normalize_params.append( { "mean": norm_t.mean.float().numpy().tolist(), "std": norm_t.std.float().numpy().tolist(), "inplace": False, } ) self.tvf_do_letterbox, self.tvf_letterbox_fill = False, None
# Handle Prismatic `image_resize_strategy` if self.image_resize_strategy == "resize-naive": self.tvf_resize_params[idx]["size"] = (resize_t.size, resize_t.size) elif self.image_resize_strategy == "letterbox": self.tvf_do_letterbox, self.tvf_letterbox_fill = True, tuple([int(x * 255) for x in self.means[idx]]) elif self.image_resize_strategy == "resize-crop": pass else: raise ValueError(f"Image resize strategy `{self.image_resize_strategy}` is not supported!")
# Dispatch **kwargs to super() super().__init__(**kwargs)
def apply_transform(self, img: Image.Image) -> torch.Tensor: """Apply `functional` variant of TIMM's Transform = Compose([Resize -> CenterCrop -> ToTensor -> Normalize])""" if self.tvf_do_letterbox: img = letterbox_pad_transform(img, self.tvf_letterbox_fill)
# [Contract] Fused Backbones expect "channel-stacked" inputs; we'll unpack on the model side! imgs_t = [] for idx in range(len(self.input_sizes)): img_idx = TVF.resize(img, **self.tvf_resize_params[idx]) img_idx = TVF.center_crop(img_idx, **self.tvf_crop_params[idx]) img_idx_t = TVF.to_tensor(img_idx) img_idx_t = TVF.normalize(img_idx_t, **self.tvf_normalize_params[idx]) imgs_t.append(img_idx_t)
# [Contract] `imgs_t` is a list of Tensors of shape [3, input_size, input_size]; stack along dim = 0 img_t = torch.vstack(imgs_t)
return img_t
def preprocess( self, images: Union[Image.Image, List[Image.Image]], return_tensors: Optional[Union[str, TensorType]] = None, **_: str, ) -> BatchFeature: """ Preprocess an image (or batch of images); note that unlike the `transformers :: BaseImageProcessor` we explicitly only handle PIL.Image.Image instances for simplicity. @param images: A (batch of) PIL.Image.Image instance(s) to preprocess. @param return_tensors: BatchFeature default Tensor format (e.g., "pt" for torch); if None, returns np.ndarray @return: Instance of `transformers :: BatchFeature` with a single key "pixel_values" """ if not isinstance(images, list): images = [images]
# Apply `self.img_transform` to each image (will return list of torch.Tensors); stack into "batched" Tensor pixel_values = torch.stack([self.apply_transform(img.convert("RGB")) for img in images])
# Return BatchFeature =>> note that for compatibility, constructor expects Dict[str, np.ndarray], so we convert return BatchFeature(data={"pixel_values": pixel_values.float().numpy()}, tensor_type=return_tensors)
def __call__(self, images: Union[Image.Image, List[Image.Image]], **kwargs) -> BatchFeature: return self.preprocess(images, **kwargs)
# === PrismaticProcessor =>> Wraps both ImageProcessor and Tokenizer ===# =>> https://github.com/huggingface/transformers/blob/main/src/transformers/models/llava/processing_llava.pyclass PrismaticProcessor(ProcessorMixin): attributes: ClassVar[List[str]] = ["image_processor", "tokenizer"] image_processor_class: str = "AutoImageProcessor" tokenizer_class: str = "AutoTokenizer"
def __init__( self, image_processor: Optional[ImageProcessingMixin] = None, tokenizer: Optional[PreTrainedTokenizerBase] = None, ) -> None: super().__init__(image_processor, tokenizer)
def __call__( self, text: Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]], images: Union[Image.Image, List[Image.Image]], padding: Union[bool, str, PaddingStrategy] = False, truncation: Optional[Union[bool, str, TruncationStrategy]] = None, max_length: Optional[int] = None, return_tensors: Optional[Union[str, TensorType]] = TensorType.PYTORCH, ) -> BatchFeature: """ Preprocess a given (batch) of text/images for a Prismatic VLM; forwards text to the underlying LLM's tokenizer, forwards images to PrismaticImageProcessor. @param text: The (batch) of text to encode; must be a string or list of strings. @param images: A (batch of) PIL.Image.Image instance(s) to preprocess. @param padding: Sequence padding strategy (if multiple specified) in < True = "longest" | "max_length" | False > @param truncation: Truncation strategy for the output sequences; requires `max_length` to be specified @param max_length: Maximum length (in tokens) to truncate @param return_tensors: Type of return tensors (usually "pt" or TensorType.PYTORCH) @return: BatchFeature with keys for `input_ids`, `attention_mask` and `pixel_values`. """ pixel_values = self.image_processor(images, return_tensors=return_tensors)["pixel_values"] text_inputs = self.tokenizer( text, return_tensors=return_tensors, padding=padding, truncation=truncation, max_length=max_length )
# [Validate] Need same number of images and text inputs! if pixel_values.shape[0] != text_inputs.input_ids.shape[0]: raise ValueError("Batch is malformed; expected same number of images and text inputs!")
return BatchFeature(data={**text_inputs, "pixel_values": pixel_values})
# === Tokenizer Dispatch Utilities =>> check `PreTrainedTokenizerBase` for documentation === def batch_decode( self, sequences: Union[List[int], List[List[int]], torch.Tensor, Any], # `Any` = np.ndarray | tf.Tensor skip_special_tokens: bool = False, clean_up_tokenization_spaces: Optional[bool] = None, **kwargs: str, ) -> List[str]: return self.tokenizer.batch_decode( sequences=sequences, skip_special_tokens=skip_special_tokens, clean_up_tokenization_spaces=clean_up_tokenization_spaces, **kwargs, )
def decode( self, token_ids: Union[int, List[int], torch.Tensor, Any], # `Any` = np.ndarray | tf.Tensor skip_special_tokens: bool = False, clean_up_tokenization_spaces: Optional[bool] = None, **kwargs: str, ) -> str: return self.tokenizer.decode( token_ids=token_ids, skip_special_tokens=skip_special_tokens, clean_up_tokenization_spaces=clean_up_tokenization_spaces, **kwargs, )
@property def model_input_names(self) -> List[str]: tokenizer_input_names = self.tokenizer.model_input_names image_processor_input_names = self.image_processor.model_input_names
return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names))123version https://git-lfs.github.com/spec/v1oid sha256:f7a3a8365e8dcaece1d23efe2fce8db8cbb55b74b3a31a71a5ef051c975dc3cbsize 162653912345678910111213141516171819202122232425262728293031{ "additional_special_tokens": [ "<|im_start|>", "<|im_end|>", "<|object_ref_start|>", "<|object_ref_end|>", "<|box_start|>", "<|box_end|>", "<|quad_start|>", "<|quad_end|>", "<|vision_start|>", "<|vision_end|>", "<|vision_pad|>", "<|image_pad|>", "<|video_pad|>" ], "eos_token": { "content": "<|endoftext|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "pad_token": { "content": "<|endoftext|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211{ "add_bos_token": false, "add_prefix_space": false, "added_tokens_decoder": { "151643": { "content": "<|endoftext|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151644": { "content": "<|im_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151645": { "content": "<|im_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151646": { "content": "<|object_ref_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151647": { "content": "<|object_ref_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151648": { "content": "<|box_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151649": { "content": "<|box_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151650": { "content": "<|quad_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151651": { "content": "<|quad_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151652": { "content": "<|vision_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151653": { "content": "<|vision_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151654": { "content": "<|vision_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151655": { "content": "<|image_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151656": { "content": "<|video_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "151657": { "content": "<tool_call>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "151658": { "content": "</tool_call>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "151659": { "content": "<|fim_prefix|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "151660": { "content": "<|fim_middle|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "151661": { "content": "<|fim_suffix|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "151662": { "content": "<|fim_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "151663": { "content": "<|repo_name|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "151664": { "content": "<|file_sep|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false } }, "additional_special_tokens": [ "<|im_start|>", "<|im_end|>", "<|object_ref_start|>", "<|object_ref_end|>", "<|box_start|>", "<|box_end|>", "<|quad_start|>", "<|quad_end|>", "<|vision_start|>", "<|vision_end|>", "<|vision_pad|>", "<|image_pad|>", "<|video_pad|>" ], "auto_map": { "AutoProcessor": "processing_prismatic.PrismaticProcessor" }, "bos_token": null, "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n", "clean_up_tokenization_spaces": false, "eos_token": "<|endoftext|>", "errors": "replace", "model_max_length": 131072, "pad_token": "<|endoftext|>", "processor_class": "PrismaticProcessor", "split_special_tokens": false, "tokenizer_class": "Qwen2Tokenizer", "unk_token": null}README.mdAdded+68
action_head--checkpoint.ptAdded+3
added_tokens.jsonAdded+24
config.jsonAdded+3182
configuration_prismatic.pyAdded+144
dataset_statistics.jsonAdded+133
generation_config.jsonAdded+7
merges.txtAdded
model.safetensorsAdded+3
modeling_prismatic.pyAdded+1001
preprocessor_config.jsonAdded+114
processing_prismatic.pyAdded+252
proprio_projector--checkpoint.ptAdded+3
special_tokens_map.jsonAdded+31
tokenizer.jsonAdded
tokenizer_config.jsonAdded+211
vocab.jsonAdded