Skip to content

Commit

Permalink
Update eval.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ritaranx authored Jul 1, 2024
1 parent a21b847 commit c66c0fa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ def last_token_pool(last_hidden_states: Tensor, attention_mask: Tensor) -> Tenso
embedding = last_hidden[torch.arange(batch_size, device=last_hidden.device), sequence_lengths]
return embedding

# The prompt for queries
def get_detailed_instruct_query(task_description: str, query: str) -> str:
return f'{task_description}\nQuery: {query}'

# The prompt for passages
def get_detailed_instruct_passage(passage: str) -> str:
return f'Represent this passage\npassage: {passage}'

Expand Down

0 comments on commit c66c0fa

Please sign in to comment.