Translation
Transformers
PyTorch
English
Hindi
viuai
viutranslate
sarus-500m
nmt
english-to-hindi
hindi-to-english
indic
devanagari
bfloat16
zero-synthetic
Instructions to use ViuAI/ViuTranslate with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ViuAI/ViuTranslate with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="ViuAI/ViuTranslate")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ViuAI/ViuTranslate", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Fix: disable progress bars and memory copy during base checkpoint download
Browse files- scripts/train.py +13 -4
scripts/train.py
CHANGED
|
@@ -183,6 +183,13 @@ def run_live_eval_previews(model, tokenizer, device):
|
|
| 183 |
# ------------------------------------------------------------------------------
|
| 184 |
def ensure_dataset_and_base_ckpt(data_dir: str, base_ckpt_path: str, token: str = None):
|
| 185 |
os.makedirs(data_dir, exist_ok=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
shards = [
|
| 187 |
"train_tokens.npy", "train_labels.npy", "train_offsets.npy", "train_domains.npy",
|
| 188 |
"val_tokens.npy", "val_labels.npy", "val_offsets.npy", "val_domains.npy",
|
|
@@ -196,14 +203,16 @@ def ensure_dataset_and_base_ckpt(data_dir: str, base_ckpt_path: str, token: str
|
|
| 196 |
if not os.path.exists(target):
|
| 197 |
print(f" • Fetching {s}...")
|
| 198 |
dl = hf_hub_download(repo_id="ViuAI/ViuTranslate-Data", filename=s, repo_type="dataset", token=token)
|
| 199 |
-
|
|
|
|
| 200 |
print(" ✅ All dataset shards downloaded.")
|
| 201 |
|
| 202 |
if not os.path.exists(base_ckpt_path):
|
| 203 |
-
print(f"\n🌐 Base checkpoint not found. Downloading base weights from ViuAI/ViuAI-500M...")
|
| 204 |
-
os.makedirs(os.path.dirname(base_ckpt_path), exist_ok=True)
|
| 205 |
dl_b = hf_hub_download(repo_id="ViuAI/ViuAI-500M", filename="checkpoints/ckpt_latest.pt", token=token)
|
| 206 |
-
|
|
|
|
| 207 |
print(" ✅ Base checkpoint ready.")
|
| 208 |
|
| 209 |
# ------------------------------------------------------------------------------
|
|
|
|
| 183 |
# ------------------------------------------------------------------------------
|
| 184 |
def ensure_dataset_and_base_ckpt(data_dir: str, base_ckpt_path: str, token: str = None):
|
| 185 |
os.makedirs(data_dir, exist_ok=True)
|
| 186 |
+
os.environ["HF_HUB_DISABLE_PROGRESS_BARS"] = "1"
|
| 187 |
+
try:
|
| 188 |
+
from huggingface_hub.utils import disable_progress_bars
|
| 189 |
+
disable_progress_bars()
|
| 190 |
+
except Exception:
|
| 191 |
+
pass
|
| 192 |
+
|
| 193 |
shards = [
|
| 194 |
"train_tokens.npy", "train_labels.npy", "train_offsets.npy", "train_domains.npy",
|
| 195 |
"val_tokens.npy", "val_labels.npy", "val_offsets.npy", "val_domains.npy",
|
|
|
|
| 203 |
if not os.path.exists(target):
|
| 204 |
print(f" • Fetching {s}...")
|
| 205 |
dl = hf_hub_download(repo_id="ViuAI/ViuTranslate-Data", filename=s, repo_type="dataset", token=token)
|
| 206 |
+
if dl != target and not os.path.exists(target):
|
| 207 |
+
shutil.copy(dl, target)
|
| 208 |
print(" ✅ All dataset shards downloaded.")
|
| 209 |
|
| 210 |
if not os.path.exists(base_ckpt_path):
|
| 211 |
+
print(f"\n🌐 Base checkpoint not found. Downloading base weights (~5.9GB) from ViuAI/ViuAI-500M...")
|
| 212 |
+
os.makedirs(os.path.dirname(base_ckpt_path) if os.path.dirname(base_ckpt_path) else ".", exist_ok=True)
|
| 213 |
dl_b = hf_hub_download(repo_id="ViuAI/ViuAI-500M", filename="checkpoints/ckpt_latest.pt", token=token)
|
| 214 |
+
if dl_b != base_ckpt_path and not os.path.exists(base_ckpt_path):
|
| 215 |
+
shutil.copy(dl_b, base_ckpt_path)
|
| 216 |
print(" ✅ Base checkpoint ready.")
|
| 217 |
|
| 218 |
# ------------------------------------------------------------------------------
|