Squish42 commited on
Commit
16bd001
0 Parent(s):

initial commit

Browse files
Files changed (3) hide show
  1. .gitattributes +55 -0
  2. bluemoon.json +3 -0
  3. dataset.yaml +190 -0
.gitattributes ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
12
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
13
+ *.model filter=lfs diff=lfs merge=lfs -text
14
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
15
+ *.npy filter=lfs diff=lfs merge=lfs -text
16
+ *.npz filter=lfs diff=lfs merge=lfs -text
17
+ *.onnx filter=lfs diff=lfs merge=lfs -text
18
+ *.ot filter=lfs diff=lfs merge=lfs -text
19
+ *.parquet filter=lfs diff=lfs merge=lfs -text
20
+ *.pb filter=lfs diff=lfs merge=lfs -text
21
+ *.pickle filter=lfs diff=lfs merge=lfs -text
22
+ *.pkl filter=lfs diff=lfs merge=lfs -text
23
+ *.pt filter=lfs diff=lfs merge=lfs -text
24
+ *.pth filter=lfs diff=lfs merge=lfs -text
25
+ *.rar filter=lfs diff=lfs merge=lfs -text
26
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
27
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ # Audio files - uncompressed
37
+ *.pcm filter=lfs diff=lfs merge=lfs -text
38
+ *.sam filter=lfs diff=lfs merge=lfs -text
39
+ *.raw filter=lfs diff=lfs merge=lfs -text
40
+ # Audio files - compressed
41
+ *.aac filter=lfs diff=lfs merge=lfs -text
42
+ *.flac filter=lfs diff=lfs merge=lfs -text
43
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
44
+ *.ogg filter=lfs diff=lfs merge=lfs -text
45
+ *.wav filter=lfs diff=lfs merge=lfs -text
46
+ # Image files - uncompressed
47
+ *.bmp filter=lfs diff=lfs merge=lfs -text
48
+ *.gif filter=lfs diff=lfs merge=lfs -text
49
+ *.png filter=lfs diff=lfs merge=lfs -text
50
+ *.tiff filter=lfs diff=lfs merge=lfs -text
51
+ # Image files - compressed
52
+ *.jpg filter=lfs diff=lfs merge=lfs -text
53
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
54
+ *.webp filter=lfs diff=lfs merge=lfs -text
55
+ *.json filter=lfs diff=lfs merge=lfs -text
bluemoon.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b71fdb78006eecf345890a5c8f40d2e1ab654668eef30906c0a6ceaa5a92234e
3
+ size 217231757
dataset.yaml ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Bluemoon
2
+ description: "Bluemoon 1-1 Fandom RP+ERP cleaned and formatted for Fastchat"
3
+
4
+ readers:
5
+ - reader: &bluemoon
6
+ type: csv
7
+ config:
8
+ fields:
9
+ conversation: 'thread_href'
10
+ from: 'message_username'
11
+ message: 'message'
12
+
13
+ writers:
14
+ - writer: &fastchat_pretty
15
+ type: fastchat
16
+ config:
17
+ indent: 2
18
+
19
+ debug_steps:
20
+ - step: &extract_ooc
21
+ type: RegexExtract
22
+ description: "Extract OOC matches for examination"
23
+ config:
24
+ path: 'out/ooc.txt'
25
+ dotAll: true
26
+ multiLine: true
27
+ escape: true
28
+ overwrite: true
29
+ patterns: [
30
+ '\{.*\}', '\[.*?\]', '\(\(.*?(\)|\W)\)+', '^\(.*?\){1}', '\n\n\(.*?\){1}$',
31
+ '(OOC|ooc|OoC)(:| |-)\n?.*?(\n|$)',
32
+ '(\n\nSee more|See more\n\n)', '^(RE|Re):.*?\n', '^NSFW:.*?\n$',
33
+ '^Note to everyone.*\)\)\n', '_*Author.*\n*_',
34
+ 'x{3,}.*TEST?x*', '^- Let me.*-\B\s+'
35
+ ]
36
+
37
+ - step: &extract_links
38
+ type: RegexExtract
39
+ description: "Extract links for examination."
40
+ config:
41
+ path: 'out/links.txt'
42
+ escape: true
43
+ overwrite: true
44
+ patterns: [
45
+ '\[img|video.*\[\/img|video\]+',
46
+ 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'
47
+ ]
48
+
49
+ - step: &extract_trim_nonwords
50
+ type: RegexExtract
51
+ description: "Extract leading non-word data for examination."
52
+ config:
53
+ path: 'out/trim-nonwords.txt'
54
+ dotAll: true
55
+ multiLine: true
56
+ escape: true
57
+ overwrite: true
58
+ patterns: [
59
+ '^(-|,|\||\.|=|_|])\W*(s|\W)+\W(\b|\n)',
60
+ '^([w_=x]{5,}|~\+\+~)(\b|\n)',
61
+ '^(_|])+(\b|\n)', '^(\s|\.|,|\|)+'
62
+ ]
63
+
64
+ steps:
65
+ - step: &html_linebreaks
66
+ type: ExactReplace
67
+ description: "Convert html <br/> line breaks to \n"
68
+ config:
69
+ replacements: [ [ '<br/>', "\n" ] ]
70
+
71
+ - step: &html_strip
72
+ type: HtmlStrip
73
+ description: "Strip HTML"
74
+
75
+ - step: &ooc_strip
76
+ type: RegexReplace
77
+ description: "Strip OOC content and some HTML errors."
78
+ config:
79
+ dotAll: true
80
+ multiLine: true
81
+ replacements: [
82
+ # This might be a bit overzealous.
83
+ [ '\{.*\}', "" ], [ '\[.*?\]', "" ], [ '\(\(.*?(\)|\W)\)+', "" ],
84
+ # Match for (...) but only at the beginning and end of messages.
85
+ [ '^\(.*?\){1}', "" ], [ '\n\n\(.*?\){1}$', "" ],
86
+ [ '(OOC|ooc|OoC)(:| |-)\n?.*?(\n|$)', "" ],
87
+ [ '(\n\nSee more|See more\n\n)', "" ], [ '^(RE|Re):.*?\n', "" ], [ '^NSFW:.*?\n$', "" ],
88
+ # More author's notes and the like
89
+ [ '^Note to everyone.*\)\)\n', "" ], [ '_*Author.*\n*_', "" ],
90
+ [ 'x{3,}.*TEST?x*', "" ], [ '^- Let me.*-', "" ]
91
+ ]
92
+
93
+ - step: &links
94
+ type: RegexReplace
95
+ description: "Remove all links"
96
+ config:
97
+ replacements: [
98
+ [ '\[(img|video).*].*\[(\/img|video)\]', "" ],
99
+ [ '[hH]ttp[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', "" ]
100
+ ]
101
+
102
+ - step: &reduce_whitespace
103
+ type: ExactReplace
104
+ description: "Reduce standalone tabs that do not affect formatting, and newlines to maximum of two consecutive."
105
+ config:
106
+ recursive: true
107
+ replacements: [
108
+ [ "\t\n", "\n" ], [ "\n\n\n", "\n\n" ], [ ' ', ' ' ], [ " \n", "\n" ]
109
+ ]
110
+
111
+ - step: &trim
112
+ type: Trim
113
+ description: "Trim leading and trailing whitespace."
114
+
115
+ - step: &ooc_prune
116
+ type: FullMatch
117
+ description: "Prune fully OOC messages with known content."
118
+ config:
119
+ action: drop
120
+ caseSensitive: false
121
+ patterns: [
122
+ "BUMP", "-BUMP-", "~BUMP~", "Closed...", "Closed", "This thread is closed", "bump.", "*DELETED*",
123
+ "...", "Okay... so you didn't make a starting post??", "-----", "~~~~~" ]
124
+
125
+ - step: &strip_unicode
126
+ type: Encoding
127
+ description: "Strip unicode sequences not present in ascii. This doesn't affect output encoding."
128
+ config:
129
+ invalid: ""
130
+ codec: us-ascii
131
+
132
+ - step: &trim_nonwords
133
+ type: RegexReplace
134
+ description: "Consecutive non-word characters at start and end of messages."
135
+ config:
136
+ dotAll: true
137
+ multiLine: true
138
+ replacements: [
139
+ [ '^(-|,|\||\.|=|_|])\W*(s|\W)+\W(\b|\n)', "" ],
140
+ [ '^([w_=x]{5,}|~\+\+~)(\b|\n)', "" ],
141
+ [ '^(_|])+(\b|\n)', "" ], [ '^(\s|\.|,|\|)+', "" ]
142
+ ]
143
+
144
+ - step: &empty
145
+ type: FullMatch
146
+ description: "Drop empty messages."
147
+ config:
148
+ action: drop
149
+ patterns: [ "" ]
150
+
151
+ - step: &two_alternating_participants
152
+ type: Participants
153
+ description: "Require exactly 2 alternating participants"
154
+ config:
155
+ min: 2
156
+ max: 2
157
+ alternating: true
158
+
159
+ - step: &rename_participants
160
+ type: RenameParticipants
161
+ description: "Rename participants to their conversation roles."
162
+ config:
163
+ names: [ "human", "gpt" ]
164
+
165
+ - step: &edge_cases
166
+ type: ExactReplace
167
+ description: "Remove a few edge cases."
168
+ config:
169
+ replacements: [
170
+ [ "TEXT TEXT TEXT TEXT TEXT\nTEXT TEXTTEXTTEXT", "" ],
171
+ [ "hvlr\n/\n", "" ],
172
+ [ "' s ,\ns s.\ns s, ,\ns.\n", "" ],
173
+ [ "I'll post first\n_ _ _ _ _ _ _ _ _ _ _\n", "" ], [ "Moved from PMs to threads", "" ],
174
+ [ "NSFW\n\n", "" ],
175
+ ]
176
+
177
+ input:
178
+ - path: "data/rentry/bluemoon/bluemoon-fanbased-roleplays-1x1.csv"
179
+ description: "Bluemoon 1-1 Fandom RP+ERP"
180
+ reader: *bluemoon
181
+ steps: [ *html_linebreaks, *links, *html_strip, *trim, *reduce_whitespace,
182
+ *ooc_strip, *ooc_prune ]
183
+
184
+ output:
185
+ - name: 'Bluemoon'
186
+ path: 'out/bluemoon.json'
187
+ description: 'Bluemoon 1-1 Fandom RP+ERP cleaned and formatted for Fastchat'
188
+ writer: fastchat
189
+ steps: [ *strip_unicode, *reduce_whitespace, *trim_nonwords, *edge_cases, *trim, *empty,
190
+ *two_alternating_participants, *rename_participants ]