upload data & generation script
Browse files- README.md +36 -0
- generate_passkey_data.py +83 -0
- personalized_passkey_retrieval.jsonl.gz +3 -0
- personalized_passkey_retrieval.py +91 -0
README.md
CHANGED
@@ -1,3 +1,39 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
|
5 |
+
### Dataset Summary
|
6 |
+
|
7 |
+
This dataset contains the data for personalized passkey retrieval task in the paper [Improving Text Embeddings with Large Language Models](https://arxiv.org/pdf/2401.00368.pdf).
|
8 |
+
|
9 |
+
### Data Fields
|
10 |
+
|
11 |
+
- `query`: a `string` feature.
|
12 |
+
- `candidates`: List of `string` feature, 100 candidates for each query.
|
13 |
+
- `label`: a `int32` feature, the index of the correct candidate in the candidates list, always 0.
|
14 |
+
- `context_length`: a `int32` feature, the approximate length for the candidate documents.
|
15 |
+
|
16 |
+
### How to use this dataset
|
17 |
+
|
18 |
+
You can load the dataset in your python code as follows:
|
19 |
+
|
20 |
+
```python
|
21 |
+
from datasets import load_dataset
|
22 |
+
|
23 |
+
dataset = load_dataset("intfloat/personalized_passkey_retrieval", split='train')
|
24 |
+
```
|
25 |
+
|
26 |
+
The data in this repo is generated by the script `generate_passkey_data.py`.
|
27 |
+
You can also tweak the script to generate your own data.
|
28 |
+
|
29 |
+
### Citation Information
|
30 |
+
|
31 |
+
If you use this dataset in your research, please cite this paper:
|
32 |
+
|
33 |
+
```
|
34 |
+
@inproceedings{Wang2023ImprovingTE,
|
35 |
+
title={Improving Text Embeddings with Large Language Models},
|
36 |
+
author={Liang Wang and Nan Yang and Xiaolong Huang and Linjun Yang and Rangan Majumder and Furu Wei},
|
37 |
+
year={2023},
|
38 |
+
}
|
39 |
+
```
|
generate_passkey_data.py
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# part of the code are based on https://github.com/dvlab-research/LongLoRA/blob/be3bb473b4ca2c291c1d26419f6e409d774dd422/passkey_retrivial.py
|
2 |
+
import json
|
3 |
+
import argparse
|
4 |
+
|
5 |
+
from numpy import random
|
6 |
+
from typing import List, Tuple, Dict
|
7 |
+
|
8 |
+
|
9 |
+
parser = argparse.ArgumentParser(description='arg parser')
|
10 |
+
parser.add_argument('--min_tokens', type=int, default=256, help='minimum token length for evaluation')
|
11 |
+
parser.add_argument('--max_tokens', type=int, default=32768, help='maximum token length for evaluation')
|
12 |
+
parser.add_argument('--num_tests', type=int, default=50, help='number of repeat testing for each length')
|
13 |
+
args = parser.parse_args()
|
14 |
+
print('Args={}'.format(json.dumps(args.__dict__, ensure_ascii=False, indent=4)))
|
15 |
+
|
16 |
+
|
17 |
+
# From https://1000randomnames.com/
|
18 |
+
ALL_RANDOM_NAMES: List[str] = ["Malayah Graves", "Cesar McLean", "Sky Morrow", "Kyree Mays", "Denisse Wilcox", "Jerry Rhodes", "Tatum Shaffer", "Dexter Baldwin", "Esmeralda Kelly", "Cooper McCann", "Joyce Jenkins", "Declan Horton", "Aitana Smith", "Liam Mahoney", "Promise Shields", "Devon Luna", "Journey Lambert", "Mario Blair", "Frances Diaz", "Nathan Singh", "Vivienne Dejesus", "Rio Garcia", "Amelia Suarez", "Soren Henry", "Summer Walton", "Dominick Chandler", "Viviana Compton", "Abner Ballard", "Alejandra Eaton", "Leighton Hancock", "Katelyn Daniel", "Grady Bentley", "Jaylin Hunter", "Archer Peralta", "Malayah Walsh", "Bodhi Benson", "Collins Spencer", "Ace Nichols", "Aliyah Hunt", "Jesus Ramirez", "Grace Dean", "Ronan Day", "Hayden Hull", "Salem Bravo", "Amoura Huerta", "Douglas Alfaro", "Yasmin Benitez", "Justice Lopez", "Gianna Gilmore", "Vihaan Savage", "Louise Vang", "Jimmy Moses", "Karter Archer", "Ephraim Adams", "Stella Coffey", "Kody Short", "Cheyenne Jarvis", "Marlon Parra", "Dalary Bowers", "Dorian Rogers", "Madelyn Garner", "Sage Lee", "Scarlett Kirk", "Alessandro Gallagher", "Elliott Ho", "Morgan Copeland", "Dayana Romero", "Bryson Jackson", "Avery Hicks", "Maddox Estes", "Brittany Hart", "Joel York", "Milan Blake", "Zyaire Sweeney", "Yara McFarland", "Dane Mosley", "Zaniyah Yang", "Malcolm Kent", "Jazmine Garrett", "Kairo Gordon", "Taylor Marin", "Aldo Bowen", "Dream Jarvis", "Marlon Robles", "Felicity Stephens", "Messiah Benton", "Anais Watson", "Greyson Barber", "Cassidy Wolf", "Jase Beasley", "Jaylah McDonald", "Calvin Nichols", "Aliyah Diaz", "Nathan Munoz", "Kehlani Bradshaw", "Emory Fitzgerald", "Marlee Mason", "Brandon Levy", "Flora Wu", "Kyson Christensen", "Carmen Bernal", "Eithan Hickman", "Scarlette Cole", "Nathaniel Hernandez", "Camila Yates", "Braylon Nicholson", "Justice Watkins", "Nash Becker", "Laura Powers", "Sean Summers", "Frankie Mason", "Brandon Knapp", "Linda Buck", "Jon Norton", "Kylee Smith", "Liam Harrell", "Kara Conway", "Orlando Wallace", "Arianna Lane", "Matias Calhoun", "Thalia Carlson", "Paul Marks", "Monica Harrell", "Nelson May", "Adriana O’brien", "Riley French", "Lorelai Peterson", "Santiago Hines", "Poppy Ayers", "Ulises Chen", "Valeria Dudley", "Colter Pacheco", "Paris Ball", "Shane Griffin", "Charlie Hodges", "Alonzo Noble", "Hunter Ahmed", "Harry Hendricks", "Dani Wallace", "Chase Matthews", "Lila Henson", "Bellamy Tang", "Belle Richard", "Ahmed Rosales", "Kinley Griffith", "Franklin Solomon", "Mylah Hail", "Hector Glass", "Clare Petersen", "Samson Wolf", "Jolene Rubio", "Titan Carey", "Alora Dixon", "Camden Snow", "Alexia Yoder", "Johan Soto", "Brynlee Hoffman", "Steven Morrison", "Rebecca Zuniga", "Sincere Tang", "Belle Bentley", "Randy Espinosa", "Braylee Nolan", "Maximo Berry", "Annabelle Merritt", "Colten Berry", "Annabelle Tate", "Dalton Noble", "Hunter Cohen", "Killian Wilson", "Luna Macdonald", "Hugh Salinas", "Royalty Gregory", "Travis Hancock", "Katelyn Mayo", "Jericho Villegas", "Jessie Bridges", "Mohammed Fowler", "Lennon Wise", "Frederick Horn", "Avah Chapman", "Knox Potts", "Ellison Ventura", "Branson Sawyer", "Marina Andersen", "Alistair Larson", "Alayna McPherson", "Foster White", "Layla Garrison", "Noe Holt", "Adelynn Hampton", "Hank Miller", "Isabella Roth", "Roy Orr", "Alaiya Christensen", "Gregory Hardin", "Vada Santiago", "Beckham Powers", "Michelle Miles", "Jared McCarty", "Halo Velasquez", "Sullivan Huang", "Francesca Hebert", "Guillermo Tran", "Kylie Richard", "Ahmed Ray", "Ruth Zhang", "Isaias Gomez", "Natalie Ware", "Tadeo Hutchinson", "Jamie Hebert", "Guillermo Flores", "Emilia Diaz", "Nathan Salas", "Amber Dejesus", "Rio Khan", "Mabel Pham", "Russell Delacruz", "Celine Tanner", "Bruno Wong", "Adelaide King", "Julian Montes", "Roselyn Benitez", "Justice Espinoza", "Lucille Singh", "Louis Zhang", "Sarai Glover", "Mack Reilly", "Tori Woodard", "Westley Snyder", "Callie Doyle", "Kashton Martin", "Mila Chapman", "Knox Foster", "Brielle Buck", "Jon Knox", "Kallie Yang", "Malcolm Xiong", "Amayah Rubio", "Titan Noble", "Hunter Torres", "Jayden Shields", "Analia Carey", "Watson Levy", "Flora McGuire", "Casey Hansen", "Hope Allen", "Carter Haley", "Addilynn Duran", "Ismael Hayes", "Iris Choi", "Khari Sherman", "Addilyn Nielsen", "Tru Hunt", "Genevieve Hill", "Isaac Preston", "Indie Hebert", "Guillermo Blevins", "Aila Phan", "Maison Lynn", "Samira Horton", "Garrett Glover", "Alessia McPherson", "Foster Schroeder", "Cameron Fox", "Antonio Atkinson", "Jazmin Rice", "Graham Wagner", "Maeve Anderson", "Jacob Solis", "Miracle Escobar", "Zachariah Beard", "Ezra Powers", "Sean Becker", "Laura Dixon", "Camden Long", "Jade Huffman", "Chris Krueger", "Kamari Mahoney", "Kamryn Roberts", "Paisley Rivers", "Bear Wilkerson", "Janiyah Short", "Hezekiah Calderon", "Serena Carrillo", "Wade Kim", "Gabriella Walls", "Larry Calhoun", "Thalia Delgado", "Colt Corona", "Marianna Powell", "Bennett Medrano", "Halle Watts", "Dakota Noble", "Hunter Suarez", "Soren Davila", "Rayne Stokes", "Santana Merritt", "Kaisley Salazar", "Brody Peck", "Crystal Stephens", "Messiah Owens", "Amaya York", "Leandro Owen", "Mikayla Hall", "Thomas Cohen", "Destiny Lugo", "Santos Benton", "Anais Chapman", "Knox Bryant", "Parker Enriquez", "Elisha Benton", "Anais Yu", "Bryant McCall", "Kai McConnell", "London Palmer", "Juniper Flores", "Lincoln Duke", "Melani Erickson", "Johnny Skinner", "Mara Figueroa", "Spencer Bryan", "Meredith Bartlett", "Kace Green", "Zoe Velazquez", "Drew Cruz", "Claire Krueger", "Jones Cherry", "Nyomi Travis", "Willie Holt", "Adelynn Simmons", "Harrison Moreno", "Mary Aguilar", "Milo Huber", "Raquel Ross", "Wesley Fields", "Annie Lara", "Caiden Duncan", "Elise Peck", "Yousef Thomas", "Elizabeth Hendrix", "Korbyn Henson", "Kinslee Orozco", "Keanu Morales", "Skylar Robbins", "Finnegan Parker", "Aubrey Mays", "Jadiel Blackburn", "Frida Olson", "Malachi Trujillo", "Danielle Rhodes", "Titus Gillespie", "Alianna Powell", "Bennett Ryan", "Morgan Simon", "Zayne Hurst", "Adalee Gutierrez", "Luca Richardson", "Allison Harrison", "Gavin Hamilton", "Mackenzie Lin", "Conor Rangel", "Gloria Bond", "Roger Lu", "Emani Waters", "Maximilian Tang", "Belle Vaughn", "Remy Meyer", "Sara Cruz", "Ryan Williams", "Ava Weeks", "Anders Roy", "Savanna Powers", "Sean Harmon", "Maren Rosas", "Remi Lowe", "Amari Ayers", "Ulises Orr", "Alaiya Beck", "Eduardo Cox", "Sadie Gallegos", "Jonas Giles", "Bailee Craig", "Odin Branch", "Luisa Nava", "Stefan Montes", "Roselyn Beck", "Eduardo Miranda", "Amina Williams", "Oliver Sheppard", "Veda Stout", "Callahan Shannon", "Harlee Phillips", "Andrew Willis", "Alexa Hicks", "Maddox Moss", "Bianca Hampton", "Hank Lucas", "Phoenix Vincent", "Aarav Wilson", "Luna Hogan", "Sonny Phan", "Elsa Perez", "Owen Weber", "Alayah Cabrera", "Cade Medina", "Elliana Hudson", "Peter Walsh", "Leia Burke", "Jax Soto", "Brynlee Humphrey", "Krew Mack", "Nadia Larson", "Rafael Vasquez", "Rose Buchanan", "Enrique Guerra", "Edith Levy", "Harold Perry", "Clara Delgado", "Colt Carrillo", "Kaylani Norton", "Callen Young", "Zoey Patterson", "Amir Hammond", "Holly Burgess", "Kolton Gordon", "Taylor Swanson", "Hugo Davenport", "Adrianna Thompson", "Theodore Meza", "Rosa Vang", "Jimmy Wu", "Liana Cano", "Terry Higgins", "Leighton McMahon", "Jakob Petersen", "Fernanda Lyons", "Cyrus Schaefer", "Mavis Koch", "Salvador Krueger", "Kamari Liu", "Pedro Harrison", "Jasmine Lugo", "Santos Christian", "Anahi Carter", "Maverick Hayden", "Avayah Boyd", "Dean Hamilton", "Mackenzie Palacios", "Thaddeus Carey", "Alora Glenn", "Zaid Whitehead", "Sylvie Blackburn", "Zahir Vang", "Madisyn Long", "Jace Price", "Piper Melendez", "Nikolas Castillo", "Eva Friedman", "Darwin Duke", "Melani Colon", "Bruce Gilbert", "Jocelyn Bush", "Tyson Ingram", "Katie Whitehead", "Zayd Herring", "Denver Barber", "Solomon Parks", "Ainsley Gregory", "Travis Gill", "Jordan Guzman", "Jude McLaughlin", "Stephanie Dickson", "Maxton Hernandez", "Camila Hancock", "Rex Palmer", "Juniper Robinson", "Matthew Duke", "Melani Wilkinson", "Leonard Ross", "Peyton Page", "Pablo Lawrence", "Lauren Villarreal", "Nikolai Rosas", "Joelle Harrington", "Omari Esparza", "Ramona Benitez", "Justice Duncan", "Elise Singh", "Louis Pham", "Raelyn Moon", "Nova Cantu", "Galilea Bailey", "Axel Ellison", "Raina Escobar", "Zachariah Castillo", "Eva Serrano", "Milan Powell", "Vivian Paul", "Noel Dillon", "Laurel Glenn", "Zaid Myers", "Lydia Griffith", "Franklin Barry", "Waverly Stone", "Finn Ibarra", "Madilynn Shannon", "Eliel McKee", "Kori Duran", "Ismael Ware", "Eileen Humphrey", "Krew Grant", "Alaina Nguyen", "Gabriel Shepard", "Noor Rivas", "Damon Herrera", "Ximena Compton", "Abner Salgado", "Avalynn Brock", "Julio Clay", "Aliana Stout", "Callahan Cantu", "Galilea Robinson", "Matthew Alvarado", "Blake Cabrera", "Cade Barber", "Cassidy Cameron", "Rayan Hopkins", "Gabriela Herrera", "River Oliver", "Camille Dudley", "Colter Manning", "Jennifer Brennan", "Curtis Duncan", "Elise Fields", "Clayton Middleton", "Madalyn Soto", "Barrett Todd", "Zariah Diaz", "Nathan Farley", "Wrenley Combs", "Ahmad Jones", "Sophia Long", "Jace Zhang", "Sarai Malone", "Ruben Craig", "Brynn House", "Yehuda Hale", "Brinley Fry", "Jacoby Dennis", "Maisie Ruiz", "Austin Knox", "Kallie Rivers", "Bear Medrano", "Halle Arias", "Alec Weiss", "Lennox Adkins", "Kylo Hanson", "Mariana Parrish", "Karsyn Raymond", "Hadlee Adams", "Hudson Andersen", "Zoie Farley", "Graysen Beil", "Itzel Perkins", "Kyrie McKenzie", "Briar Hodge", "Reign Clayton", "Saige Wilkins", "Yusuf Russo", "Tinsley Gates", "Ermias Brown", "Charlotte Jenkins", "Declan Cain", "Kendra Padilla", "Jaden Bernal", "Emmeline Vargas", "Ryker Duarte", "Kynlee Benton", "Jamal Gallagher", "Elliott Haynes", "Kason Arroyo", "Kyra Leblanc", "Braden Briggs", "Alia O’Connor", "Princeton Bartlett", "Aubrielle Ward", "Jameson McBride", "Kelsey Lynch", "Zane Hahn", "Fallon Stein", "Creed Hernandez", "Camila Decker", "Taylor Owen", "Mikayla Chandler", "Royal Townsend", "Azalea Bautista", "Raul Velez", "Megan Enriquez", "Elisha Walter", "Penny Beard", "Nathanael Joseph", "Gracelynn Wallace", "Chase Solomon", "Mylah Vargas", "Ryker Byrd", "Giselle Griffin", "Ayden Small", "Zaria Shepherd", "Ronald Wolfe", "Hallie Callahan", "Quinton McCarty", "Halo Clarke", "Stetson Andrews", "Payton Marks", "Amos Espinoza", "Lucille Mullins", "Allen Valenzuela", "Henley Bender", "Zavier Castro", "Eloise Herman", "Juelz Correa", "Valery Cline", "Cullen Greene", "Selena Wise", "Frederick Zavala", "Liv Webb", "Lorenzo Benitez", "Aliza Gray", "Nicholas Graves", "Elle Graham", "Giovanni McClure", "Estella Hendrix", "Korbyn Lane", "Amy Smith", "Liam Stevens", "Katherine McCann", "Heath Harrell", "Kara Schmitt", "Murphy Hahn", "Fallon Kaur", "Augustine Ponce", "Aileen Munoz", "Justin Murillo", "Mikaela Yates", "Braylon Gates", "Melina Hunter", "Archer Fox", "Juliette Daniels", "Xander Gutierrez", "Savannah Park", "Daxton McKenzie", "Briar Rasmussen", "Will Marshall", "Adalyn Blair", "Troy Lester", "Averi Clements", "Fisher O’Connor", "Charli Rosales", "Wilder Hunt", "Genevieve Russell", "Weston Weiss", "Lennox Ross", "Wesley Campos", "Sutton Wall", "Issac Pitts", "Nala Flores", "Lincoln Beltran", "Kaydence Bonilla", "Aden Harper", "Ana Compton", "Abner McCarthy", "Kira McCoy", "Jett West", "Remi Perry", "Waylon Murphy", "Bella Blackburn", "Zahir Kelley", "Rosalie Hughes", "Everett Pittman", "Marie Parra", "Davion Sierra", "Marceline Davis", "Lucas Robles", "Felicity Richards", "Holden Marks", "Monica Patterson", "Amir Daniel", "Joy Durham", "Kellen Perez", "Eleanor Munoz", "Justin Love", "Avianna O’Neal", "Eddie Morris", "Genesis Carr", "Kash Burton", "Miriam Booker", "Dominik Powell", "Vivian Villalobos", "Reuben Roth", "Elliot McFarland", "Dane Bryant", "Parker McClain", "Mitchell Mathis", "Anne McMillan", "Rocky Bauer", "Haley Griffin", "Ayden Duran", "Willa Rosas", "Remi Esquivel", "Jaylee Bailey", "Axel Blackwell", "Saoirse Bond", "Roger Wang", "Kailani Rollins", "Wes Owens", "Amaya Harrison", "Gavin Gutierrez", "Savannah Simpson", "Elliott Kline", "Sevyn Schroeder", "Izaiah Gallegos", "Elsa Mack", "Gunner Ali", "Zelda Orr", "Benicio Henson", "Kinslee Larsen", "Brycen Schroeder", "Cameron Perry", "Waylon Freeman", "Norah Henderson", "Beau Le", "Myla Hanna", "Aydin Pollard", "Marisol Greer", "Koda Melendez", "Bethany Chang", "Ari Pearson", "Kiara Blackwell", "Marcellus Ellison", "Raina McGuire", "Casey McCann", "Joyce Morse", "Bode Truong", "Judith Coleman", "Micah McCullough", "Hana Mejia", "Atticus Church", "Ayleen Mosley", "Rayden Moss", "Bianca Estrada", "Phoenix Gonzales", "Hadley Rush", "Kaiser Trujillo", "Danielle Sutton", "Warren Fischer", "Maci Black", "Matteo Watkins", "Lola Khan", "Kendrick Tran", "Kylie Cross", "Fabian Booth", "Zariyah McConnell", "London Gross", "Angel McDowell", "Lachlan Richardson", "Allison Rivers", "Bear Silva", "Lucia Christensen", "Gregory Parra", "Dalary Ballard", "Kenzo Dorsey", "Addyson McKay", "Joey Baldwin", "Esmeralda Burgess", "Kolton Manning", "Jennifer Vance", "Casen Wang", "Kailani Waters", "Maximilian Mayo", "Aarya Sloan", "Ocean Shepherd", "Katalina Sheppard", "Trent Pitts", "Nala Jacobs", "Bryan Robinson", "Nora Warner", "Jaxton Shields", "Analia Espinoza", "Dallas Espinosa", "Braylee Knox", "Valentin Lloyd", "Emely Wells", "Max Frank", "Dior Kramer", "Kylan Wilkins", "Amalia Meadows", "Wayne McKinney", "Gwendolyn Stone", "Finn Harper", "Ana Gibson", "Tyler Fuller", "Oakley Zhang", "Isaias Schmidt", "Kimberly Horn", "Wilson Durham", "Tiffany Vasquez", "Rowan Callahan", "Kimber Waters", "Maximilian Reed", "Valentina Larsen", "Brycen Quintero", "Keyla Sparks", "Drake Greene", "Selena Avery", "Jakari Velasquez", "Esme Dudley", "Colter O’Connell", "Jillian Stevens", "Zachary Gray", "Sarah Stanley", "Manuel Barrett", "Kendall Branch", "Keenan Gutierrez", "Savannah Knapp", "Boden Herrera", "Ximena Ferguson", "Miguel Richards", "Trinity Marshall", "Kaiden Spencer", "Alyssa Bentley", "Randy Park", "Lia Vega", "Aidan Dunn", "Olive Harrell", "Nelson Knight", "Gracie Estrada", "Phoenix Welch", "Amira Hayden", "Leroy Novak", "Kaiya Rosario", "Jedidiah Gilbert", "Jocelyn Brown", "Elijah Nava", "Scout Hancock", "Rex Henderson", "Maria Bradshaw", "Emory Haley", "Addilynn Dean", "Ronan Zimmerman", "Ariyah Villegas", "Clyde Frost", "Paula Parks", "Gianni Frost", "Paula McGee", "Conner Levy", "Flora Hall", "Thomas Bates", "Madilyn Carter", "Maverick Davidson", "Jayla Lugo", "Santos Herrera", "Ximena Stephenson", "Joe Blackburn", "Frida Schaefer", "Ishaan Duffy", "Addisyn Ashley", "Kylen Wu", "Liana Kerr", "Louie Quintero", "Keyla Tyler", "Emmitt Hood", "Briana Ali", "Arjun Peck", "Crystal Deleon", "Nasir Liu", "Kate Newman", "Anderson Boone", "Mariam Richards", "Holden Griffin", "Charlie Walter", "Lochlan McCormick", "Macie Reid", "Josue Stein", "Leilany Bernal", "Eithan Hart", "Gemma Humphrey", "Krew Gregory", "Alaya Liu", "Pedro Mendoza", "Cora Case", "Bentlee Fowler", "Lennon Kramer", "Kylan Mercado", "Mckinley Charles", "Conrad Alvarez", "Leilani Horn", "Wilson Faulkner", "Ansley Blake", "Zyaire May", "Adriana Thornton", "Malik Huerta", "Dulce Montoya", "Ford Marshall", "Adalyn Duncan", "Avery Krueger", "Kamari Ingram", "Tripp Graham", "Alaia Walker", "Luke Cobb", "Aviana Preston", "Vincenzo Summers", "Frankie Zamora", "Quentin Poole", "Bonnie Vaughan", "Castiel Hunter", "Khloe Thompson", "Theodore Ray", "Ruth McKay", "Joey Myers", "Lydia Valenzuela", "Jamari Mills", "June Anderson", "Jacob Nguyen", "Nova Juarez", "Joaquin Odom", "Laylani Guerra", "Leland Frederick", "Sariyah Zhang", "Isaias Ross", "Peyton Schneider", "Raymond Lindsey", "Colette Greer", "Koda Compton", "Elina Grant", "Leon Dougherty", "Alisson Trevino", "Jaime Ramirez", "Grace Chen", "Emmanuel Snow", "Alexia Hopkins", "Ali Barnett", "Harlow Burnett", "Davis Silva", "Lucia Estrada", "Phoenix Wilkinson", "Siena Kane", "Brock Gregory", "Alaya Rodriguez", "Henry Carlson", "Kali Person", "Moses King", "Victoria Bonilla", "Aden Orr", "Alaiya Robertson", "Emiliano Summers", "Frankie Wilkinson", "Leonard Cameron", "Julie Sanchez", "Joseph Love", "Avianna Ashley", "Kylen Ware", "Eileen Owen", "Cannon Chang", "Ophelia Hughes", "Everett Gallegos", "Ari Valenzuela", "Jamari Horton", "Aitana Orozco", "Keanu Phan", "Elsa Day", "Kayson Diaz", "Elena Castro", "Jasper Baxter", "Lara Garner", "Sage Rivas", "Averie Cortes", "Banks Cook", "Aaliyah Shepherd", "Ronald Cunningham", "Marley Sparks", "Drake Huffman", "Hayley Carr", "Kash Neal", "Talia Stevens", "Zachary Salazar", "Freya Schaefer", "Ishaan Rosas", "Joelle Anthony", "Shiloh McKinney", "Gwendolyn Harrington", "Omari O’Neill", "Kenna Wang", "Cohen Figueroa", "Lilith McKay", "Joey Wise", "Mira Sharp", "Royce Morris", "Genesis Patel", "Parker Mathews"]
|
19 |
+
|
20 |
+
|
21 |
+
def generate_prompt_landmark(n_garbage: int, seed: int, n_candidates: int = 100) -> Tuple[str, List[str]]:
|
22 |
+
"""Generates a text file and inserts an passkey at a random position."""
|
23 |
+
rnd_state = random.get_state()
|
24 |
+
random.seed(seed)
|
25 |
+
|
26 |
+
assert n_candidates <= len(ALL_RANDOM_NAMES)
|
27 |
+
candidate_names: List[str] = random.choice(
|
28 |
+
ALL_RANDOM_NAMES, n_candidates, replace=False
|
29 |
+
).tolist()
|
30 |
+
query: str = f'what is the passkey for {candidate_names[0]}?'
|
31 |
+
candidates: List[str] = []
|
32 |
+
|
33 |
+
for name in candidate_names:
|
34 |
+
n_garbage_prefix = random.randint(0, n_garbage)
|
35 |
+
n_garbage_suffix = n_garbage - n_garbage_prefix
|
36 |
+
|
37 |
+
garbage = "The grass is green. The sky is blue. The sun is yellow. Here we go. There and back again."
|
38 |
+
garbage_inf = " ".join([garbage] * 5000)
|
39 |
+
assert len(garbage_inf) >= n_garbage
|
40 |
+
garbage_prefix = garbage_inf[:n_garbage_prefix]
|
41 |
+
garbage_suffix = garbage_inf[:n_garbage_suffix]
|
42 |
+
pass_key = random.randint(1, 50000)
|
43 |
+
information_line = f"{name}'s pass key is {pass_key}. Remember it. {pass_key} is the pass key for {name}."
|
44 |
+
lines = [
|
45 |
+
garbage_prefix,
|
46 |
+
information_line,
|
47 |
+
garbage_suffix,
|
48 |
+
]
|
49 |
+
candidates.append("\n".join(lines))
|
50 |
+
|
51 |
+
random.set_state(rnd_state)
|
52 |
+
return query, candidates
|
53 |
+
|
54 |
+
|
55 |
+
def main():
|
56 |
+
num_tokens = args.min_tokens
|
57 |
+
|
58 |
+
examples: List[Dict] = []
|
59 |
+
while num_tokens <= args.max_tokens:
|
60 |
+
# This is a rough ratio to control the number of texts and tokens
|
61 |
+
# we change from 3.75 to 3.5, so that the estimation for short contexts is more accurate
|
62 |
+
n_garbage = int(3.5 * num_tokens)
|
63 |
+
for seed in range(args.num_tests):
|
64 |
+
query, candidates = generate_prompt_landmark(n_garbage, seed)
|
65 |
+
examples.append(
|
66 |
+
{
|
67 |
+
"query": query,
|
68 |
+
"candidates": candidates,
|
69 |
+
"label": 0,
|
70 |
+
"context_length": num_tokens
|
71 |
+
}
|
72 |
+
)
|
73 |
+
num_tokens *= 2
|
74 |
+
|
75 |
+
out_path: str = 'personalized_passkey_retrieval.jsonl'
|
76 |
+
with open(out_path, "w", encoding='utf-8') as f:
|
77 |
+
for example in examples:
|
78 |
+
f.write(json.dumps(example) + "\n")
|
79 |
+
print(f"Saved {len(examples)} examples to {out_path}.")
|
80 |
+
|
81 |
+
|
82 |
+
if __name__ == "__main__":
|
83 |
+
main()
|
personalized_passkey_retrieval.jsonl.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5cb041f19817cbc6c687d4214a36bd3ac80a74719a15e0ae6c36e06e24c86fff
|
3 |
+
size 9231068
|
personalized_passkey_retrieval.py
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
"""personalized_passkey_retrieval: a synthetic dataset to evaluate long-context embeddings"""
|
15 |
+
|
16 |
+
|
17 |
+
import json
|
18 |
+
import gzip
|
19 |
+
import datasets
|
20 |
+
|
21 |
+
logger = datasets.logging.get_logger(__name__)
|
22 |
+
|
23 |
+
# Find for instance the citation on arxiv or on the dataset repo/website
|
24 |
+
_CITATION = """\
|
25 |
+
@inproceedings{Wang2023ImprovingTE,
|
26 |
+
title={Improving Text Embeddings with Large Language Models},
|
27 |
+
author={Liang Wang and Nan Yang and Xiaolong Huang and Linjun Yang and Rangan Majumder and Furu Wei},
|
28 |
+
year={2023},
|
29 |
+
}
|
30 |
+
"""
|
31 |
+
|
32 |
+
# You can copy an official description
|
33 |
+
_DESCRIPTION = """\
|
34 |
+
This dataset contains synthetic data for personalized passkey retrieval.
|
35 |
+
It is only intended for evaluation purposes, you should not use it for training.
|
36 |
+
"""
|
37 |
+
|
38 |
+
_URLS = {
|
39 |
+
"train": "personalized_passkey_retrieval.jsonl.gz"
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
class Query2docMsmarco(datasets.GeneratorBasedBuilder):
|
44 |
+
VERSION = datasets.Version("0.1.0")
|
45 |
+
BUILDER_CONFIGS = [
|
46 |
+
datasets.BuilderConfig(name='plain_text', version=VERSION, description='plain text')
|
47 |
+
]
|
48 |
+
|
49 |
+
def _info(self):
|
50 |
+
features = datasets.Features(
|
51 |
+
{
|
52 |
+
"query": datasets.Value("string"),
|
53 |
+
"candidates": datasets.features.Sequence(datasets.Value("string")),
|
54 |
+
"label": datasets.Value("int32"),
|
55 |
+
"context_length": datasets.Value("int32"),
|
56 |
+
}
|
57 |
+
)
|
58 |
+
return datasets.DatasetInfo(
|
59 |
+
description=_DESCRIPTION,
|
60 |
+
features=features,
|
61 |
+
citation=_CITATION,
|
62 |
+
)
|
63 |
+
|
64 |
+
def _split_generators(self, dl_manager):
|
65 |
+
downloaded_files = dl_manager.download(_URLS)
|
66 |
+
print(downloaded_files)
|
67 |
+
return [
|
68 |
+
datasets.SplitGenerator(
|
69 |
+
name=datasets.Split.TRAIN,
|
70 |
+
# These kwargs will be passed to _generate_examples
|
71 |
+
gen_kwargs={
|
72 |
+
"filepath": downloaded_files["train"],
|
73 |
+
"split": "train",
|
74 |
+
},
|
75 |
+
),
|
76 |
+
]
|
77 |
+
|
78 |
+
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
79 |
+
def _generate_examples(self, filepath, split):
|
80 |
+
id_ = 0
|
81 |
+
with gzip.open(open(filepath, "rb"), "rt", encoding="utf-8") as f:
|
82 |
+
for line in f:
|
83 |
+
if line:
|
84 |
+
example = json.loads(line)
|
85 |
+
yield id_, {
|
86 |
+
"query": example["query"],
|
87 |
+
"candidates": example["candidates"],
|
88 |
+
"label": example["label"],
|
89 |
+
"context_length": example["context_length"],
|
90 |
+
}
|
91 |
+
id_ += 1
|