uonlp/CulturaX
Viewer • Updated • 7.14B • 66.4k • 667
Run dschulmeist/TiME-ur-xs on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Use HF Jobs to fine-tune https://huggingface.co/dschulmeist/TiME-ur-xs. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to run batch inference with https://huggingface.co/dschulmeist/TiME-ur-xs on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
How to use dschulmeist/TiME-ur-xs with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("feature-extraction", model="dschulmeist/TiME-ur-xs") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("dschulmeist/TiME-ur-xs")
model = AutoModel.from_pretrained("dschulmeist/TiME-ur-xs", device_map="auto")Monolingual BERT-style encoder that outputs embeddings for Urdu. Distilled from FacebookAI/xlm-roberta-large.
from transformers import AutoTokenizer, AutoModel
import torch
repo = "dschulmeist/TiME-ur-xs"
tok = AutoTokenizer.from_pretrained(repo)
mdl = AutoModel.from_pretrained(repo)
def mean_pool(last_hidden_state, attention_mask):
mask = attention_mask.unsqueeze(-1).type_as(last_hidden_state)
return (last_hidden_state * mask).sum(1) / mask.sum(1).clamp(min=1e-9)
inputs = tok(["example sentence"], padding=True, truncation=True, return_tensors="pt")
outputs = mdl(**inputs)
emb = mean_pool(outputs.last_hidden_state, inputs['attention_mask'])
print(emb.shape)