Datasets:

Modalities:
Tabular
Text
Formats:
parquet
ArXiv:
Libraries:
Datasets
pandas
License:
cakiki commited on
Commit
742e83e
1 Parent(s): b4ae29f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +14 -0
README.md CHANGED
@@ -20,6 +20,10 @@ license: apache-2.0
20
 
21
  ![ROOTS Dataset Scatterplot](./datashader.png)
22
 
 
 
 
 
23
  ```python
24
  import os
25
  import numpy as np
@@ -53,6 +57,7 @@ dset = load_dataset(..., split="train")
53
 
54
  dset = dset.map(batch_tokenize, batched=True, batch_size=64, num_proc=28)
55
 
 
56
  max_shard_size = convert_file_size_to_int('300MB')
57
  dataset_nbytes = dset.data.nbytes
58
  num_shards = int(dataset_nbytes / max_shard_size) + 1
@@ -63,6 +68,11 @@ for shard_index in tqdm(range(num_shards)):
63
  shard = dset.shard(num_shards=num_shards, index=shard_index, contiguous=True)
64
  shard.to_parquet(f"{dset_name}/tokenized/tokenized-{shard_index:03d}.parquet")
65
 
 
 
 
 
 
66
  client = Client() # To keep track of dask computation
67
  client
68
 
@@ -90,7 +100,11 @@ tsne = TSNE(
90
  )
91
 
92
  tsne_embedding = tsne.fit(X)
 
 
 
93
 
 
94
  df = pd.DataFrame(data=tsne_embedding, columns=['x','y'])
95
  agg = ds.Canvas(plot_height=600, plot_width=600).points(df, 'x', 'y')
96
  img = ds.tf.shade(agg, cmap=cc.fire, how='eq_hist')
 
20
 
21
  ![ROOTS Dataset Scatterplot](./datashader.png)
22
 
23
+ What follows is research code. It is by no means optimized for speed, efficiency, or readability.
24
+
25
+ ## Data loading, tokenizing and sharding
26
+
27
  ```python
28
  import os
29
  import numpy as np
 
57
 
58
  dset = dset.map(batch_tokenize, batched=True, batch_size=64, num_proc=28)
59
 
60
+ dset_name = "roots_subset"
61
  max_shard_size = convert_file_size_to_int('300MB')
62
  dataset_nbytes = dset.data.nbytes
63
  num_shards = int(dataset_nbytes / max_shard_size) + 1
 
68
  shard = dset.shard(num_shards=num_shards, index=shard_index, contiguous=True)
69
  shard.to_parquet(f"{dset_name}/tokenized/tokenized-{shard_index:03d}.parquet")
70
 
71
+ ```
72
+
73
+ ## Embedding
74
+
75
+ ```python
76
  client = Client() # To keep track of dask computation
77
  client
78
 
 
100
  )
101
 
102
  tsne_embedding = tsne.fit(X)
103
+ ```
104
+
105
+ ## Plotting
106
 
107
+ ```python
108
  df = pd.DataFrame(data=tsne_embedding, columns=['x','y'])
109
  agg = ds.Canvas(plot_height=600, plot_width=600).points(df, 'x', 'y')
110
  img = ds.tf.shade(agg, cmap=cc.fire, how='eq_hist')