Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Fix issues for a 'DistributedDataParallel' object (#3787)
Browse files Browse the repository at this point in the history
Fix error to address the `AttributeError: 'DistributedDataParallel' object has no attribute 'tokenize_query'`
  • Loading branch information
jianguoz authored Jul 15, 2021
1 parent ef1511f commit de5a42d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion parlai/agents/rag/rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,10 @@ def _set_query_vec(self, observation: Message) -> Message:
return observation with query vec.
"""
query_str = observation[self._query_key]
observation['query_vec'] = self.model.tokenize_query(query_str)
if hasattr(self.model, 'module'):
observation['query_vec'] = self.model.module.tokenize_query(query_str)
else:
observation['query_vec'] = self.model.tokenize_query(query_str)
return observation

def _set_input_turn_cnt_vec(self, observation: Message) -> Message:
Expand Down

0 comments on commit de5a42d

Please sign in to comment.