Closed Lizhuoling closed 4 months ago
I have checked the code carefully. It is because dataset_kwargs['standardize_fn'] is a function, while ModuleSpec.instantiate(standardize_fn)(traj) in octo/data/dataset.py expects to get the keys of dataset_kwargs['standardize_fn']. So I guess the problem is within the version of octo. What version of octo code do you use?
Ah thanks for flagging! Octo recently released some major code updates that probably broke our dependency.
Please use the Octo repo at commit 85b83fc19657ab407a7f56558a5384ae56fe453b
(I updated the README accordingly)
I try running your code, but an error is raised. I cannot figure out what causes the error. The error information is as follows:
Traceback (most recent call last): File "/home/cvte1/disk1/twilight/code/droid_policy_learning/robomimic/scripts/train.py", line 578, in main train(config, device=device) File "/home/cvte1/disk1/twilight/code/droid_policy_learning/robomimic/scripts/train.py", line 122, in train [make_dataset_from_rlds(dataset_kwargs, train=True)[1] for dataset_kwargs in dataset_kwargs_list] File "/home/cvte1/disk1/twilight/code/droid_policy_learning/robomimic/scripts/train.py", line 122, in
[make_dataset_from_rlds( dataset_kwargs, train=True)[1] for dataset_kwargs in dataset_kwargs_list]
File "/home/cvte1/disk1/twilight/code/droid_policy_learning/octo/octo/data/dataset.py", line 395, in make_dataset_from_rlds
full_dataset = full_dataset.traj_map(restructure).filter(is_nonzero_length)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/dlimp/dataset.py", line 17, in wrapper
result = f(args, kwargs)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/dlimp/dataset.py", line 178, in traj_map
return super().map(fn, num_parallel_calls=num_parallel_calls, kwargs)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 2280, in map
return map_op._map_v2(
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/data/ops/map_op.py", line 40, in _map_v2
return _ParallelMapDataset(
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/data/ops/map_op.py", line 148, in init
self._map_func = structured_function.StructuredFunctionWrapper(
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/data/ops/structured_function.py", line 265, in init
self._function = fn_factory()
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/eager/polymorphic_function/polymorphic_function.py", line 1227, in get_concrete_function
concrete = self._get_concrete_function_garbage_collected(args, kwargs)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/eager/polymorphic_function/polymorphic_function.py", line 1197, in _get_concrete_function_garbage_collected
self._initialize(args, kwargs, add_initializers_to=initializers)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/eager/polymorphic_function/polymorphic_function.py", line 695, in _initialize
self._concrete_variable_creation_fn = tracing_compilation.trace_function(
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/eager/polymorphic_function/tracing_compilation.py", line 178, in trace_function
concrete_function = _maybe_define_function(
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/eager/polymorphic_function/tracing_compilation.py", line 283, in _maybe_define_function
concrete_function = _create_concrete_function(
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/eager/polymorphic_function/tracing_compilation.py", line 310, in _create_concrete_function
traced_func_graph = func_graph_module.func_graph_from_py_func(
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/framework/func_graph.py", line 1059, in func_graph_from_py_func
func_outputs = python_func(*func_args, *func_kwargs)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/eager/polymorphic_function/polymorphic_function.py", line 598, in wrapped_fn
out = weak_wrapped_fn().wrapped(args, kwds)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/data/ops/structured_function.py", line 231, in wrapped_fn
ret = wrapper_helper(args)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/data/ops/structured_function.py", line 161, in wrapper_helper
ret = autograph.tf_convert(self._func, ag_ctx)(nested_args)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/autograph/impl/api.py", line 693, in wrapper
raise e.ag_error_metadata.to_exception(e)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/autograph/impl/api.py", line 690, in wrapper
return converted_call(f, args, kwargs, options=options)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/autograph/impl/api.py", line 439, in converted_call
result = converted_f(*effective_args, *kwargs)
File "/tmp/autograph_generated_file2xik31ah.py", line 32, in tfrestructure
ag.if_stmt(ag.ld(standardize_fn) is not None, if_body, else_body, get_state, set_state, ('traj',), 1)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/autograph/operators/control_flow.py", line 1217, in if_stmt
_py_if_stmt(cond, body, orelse)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/autograph/operators/control_flow.py", line 1270, in _py_if_stmt
return body() if cond else orelse()
File "/tmp/autograph_generated_file2xik31ah.py", line 27, in if_body
traj = ag.converted_call(ag.converted_call(ag.ld(ModuleSpec).instantiate, (ag.ld(standardize_fn),), None, fscope), (ag.ld(traj),), None, fscope)
File "/home/twilight/home/miniforge/envs/droid/lib/python3.10/site-packages/tensorflow/python/autograph/impl/api.py", line 441, in converted_call
result = converted_f(effective_args)
File "/tmp/autograph_generated_file6wu6pymj.py", line 22, in tfinstantiate
ag.if_stmt(ag__.converted_call(ag.ld(set), (ag__.converted_call(ag__.ld(spec).keys, (), None, fscope),), None, fscope) != {'module', 'name', 'args', 'kwargs'}, if_body, else_body, get_state, set_state, (), 0)
AttributeError: in user code: