ViuAI commited on
Commit
fa47862
·
verified ·
1 Parent(s): 38da7f3

Upload 2 files

Browse files
Files changed (1) hide show
  1. code/train.py +5 -5
code/train.py CHANGED
@@ -134,7 +134,7 @@ class ShardPool:
134
  except Exception as e:
135
  logger.warning(f"Failed to list dataset repo {self.repo_id}, trying as model repo. Error: {e}")
136
  files = self.api.list_repo_files(repo_id=self.repo_id, repo_type="model", token=self.token)
137
- self.available_files = [f for f in files if f.startswith("shards/hi_indiccorp_") and f.endswith(".bin")]
138
  np.random.shuffle(self.available_files)
139
 
140
  def fill(self, ctx_len):
@@ -244,7 +244,7 @@ def main():
244
  start_step = load_checkpoint(unwrapped_model, optimizer, scaler, api, token, "ViuAI/ViuRec", strict=False)
245
 
246
  work_dir = Path("/kaggle/working" if Path("/kaggle/working").exists() else ".")
247
- shard_pool = ShardPool(api, "ViuAI/ViuCorp", work_dir / "shards", token, vocab_size)
248
  shard_pool.fill(args.ctx_len)
249
 
250
  # Val Data Safely (cap at 20M tokens)
@@ -252,12 +252,12 @@ def main():
252
  if is_main:
253
  logger.info("Loading validation data...")
254
  try:
255
- val_files = [f for f in api.list_repo_files(repo_id="ViuAI/ViuCorp", repo_type="dataset", token=token) if f.startswith("val_shards/")]
256
  except Exception:
257
- val_files = [f for f in api.list_repo_files(repo_id="ViuAI/ViuCorp", repo_type="model", token=token) if f.startswith("val_shards/")]
258
  try:
259
  if val_files:
260
- val_p = hf_hub_download(repo_id="ViuAI/ViuCorp", repo_type="dataset", filename=val_files[0], local_dir=work_dir, token=token)
261
  dtype = np.uint16 if vocab_size <= 65535 else np.uint32
262
  val_arr = np.memmap(val_p, dtype=dtype, mode="r")
263
  max_toks = 20_000_000
 
134
  except Exception as e:
135
  logger.warning(f"Failed to list dataset repo {self.repo_id}, trying as model repo. Error: {e}")
136
  files = self.api.list_repo_files(repo_id=self.repo_id, repo_type="model", token=self.token)
137
+ self.available_files = [f for f in files if f.startswith("shards/") and f.endswith(".bin") and not f.endswith("_val.bin")]
138
  np.random.shuffle(self.available_files)
139
 
140
  def fill(self, ctx_len):
 
244
  start_step = load_checkpoint(unwrapped_model, optimizer, scaler, api, token, "ViuAI/ViuRec", strict=False)
245
 
246
  work_dir = Path("/kaggle/working" if Path("/kaggle/working").exists() else ".")
247
+ shard_pool = ShardPool(api, "ViuAI/viuai-500m-data", work_dir / "shards", token, vocab_size)
248
  shard_pool.fill(args.ctx_len)
249
 
250
  # Val Data Safely (cap at 20M tokens)
 
252
  if is_main:
253
  logger.info("Loading validation data...")
254
  try:
255
+ val_files = [f for f in api.list_repo_files(repo_id="ViuAI/viuai-500m-data", repo_type="dataset", token=token) if f.startswith("shards/") and f.endswith("_val.bin")]
256
  except Exception:
257
+ val_files = [f for f in api.list_repo_files(repo_id="ViuAI/viuai-500m-data", repo_type="model", token=token) if f.startswith("shards/") and f.endswith("_val.bin")]
258
  try:
259
  if val_files:
260
+ val_p = hf_hub_download(repo_id="ViuAI/viuai-500m-data", repo_type="dataset", filename=val_files[0], local_dir=work_dir, token=token)
261
  dtype = np.uint16 if vocab_size <= 65535 else np.uint32
262
  val_arr = np.memmap(val_p, dtype=dtype, mode="r")
263
  max_toks = 20_000_000