def _generate_json_state_nostate_ds(episode: dict, dataset_name: str):
    """
    Generate the json dict and state for an episode in the dataset without state.
    If not state, we use the last action as current state.
    """
    # Load some constants from the config
    IMG_HISTORY_SIZE = config['common']['img_history_size']
    if IMG_HISTORY_SIZE < 1:
        raise ValueError("Config `img_history_size` must be at least 1.")
    ACTION_CHUNK_SIZE = config['common']['action_chunk_size']
    if ACTION_CHUNK_SIZE < 1:
        raise ValueError("Config `action_chunk_size` must be at least 1.")

    # Initialize the episode_metadata
    episode_metadata = {
        'dataset_name': dataset_name,
        '#steps': 0,
        'instruction': None
    }
    
    last_base_act = None
    last_arm_act = None
    episode_states = []
    episode_masks = []
    has_base = None
    for step_id, step in enumerate(iter(episode['steps'])):
        # Parse the action
        action = step['action']
        if has_base is None:
            has_base = 'base_concat' in action
        if has_base:
            base_act = action['base_concat']
            if last_base_act is None:
                last_base_act = base_act * 0 # Initialize

        # Parse the arm action
        arm_act = action['arm_concat']
        if last_arm_act is None:
            last_arm_act = arm_act * 0 # Initialize

        # Parse the act format
        # Action format as the state format
        act_format = action['format'].numpy().decode('utf-8')

        # Assemble the state vector
        if has_base:
            last_act_concat = tf.concat([last_arm_act, last_base_act], axis=0)
        else:
            last_act_concat = last_arm_act
        state_vec, mask_vec = assemble_state_vec(
            last_act_concat, act_format)

        episode_states.append(state_vec)
        episode_masks.append(mask_vec)

        # Parse the task instruction
        instr = step['observation']['natural_language_instruction']
        instr = instr.numpy().decode('utf-8')
        instr = capitalize_and_period(instr)
        
        # Write to the episode_metadata
        if episode_metadata['instruction'] is None:
            episode_metadata['instruction'] = instr

        # Update the last_arm_act and last_base_act
        last_arm_act = arm_act
        if has_base:
            last_base_act = base_act
    
    episode_metadata['#steps'] = step_id
    episode_states = tf.stack(episode_states)
    episode_masks = tf.stack(episode_masks)
    
    return episode_metadata, episode_states, episode_masks

    Generate the json dict and state for an episode in the dataset without state.
    If not state, we use the last action as current state.
    
policy/RDT/data/preprocess.py