Text Classification
Transformers
ONNX
Safetensors
Transformers.js
modernbert
topic-classification
domain-classification
web-classification
weborganizer
data-curation
pretraining-data
mmbert
text-embeddings-inference
Instructions to use Horizon-Labs/multilingual-web-topic-format-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Horizon-Labs/multilingual-web-topic-format-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Horizon-Labs/multilingual-web-topic-format-base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Horizon-Labs/multilingual-web-topic-format-base") model = AutoModelForSequenceClassification.from_pretrained("Horizon-Labs/multilingual-web-topic-format-base", device_map="auto") - Transformers.js
How to use Horizon-Labs/multilingual-web-topic-format-base with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-classification', 'Horizon-Labs/multilingual-web-topic-format-base'); - Notebooks
- Google Colab
- Kaggle
Download code/edu/build_label_in.py from Horizon-Labs/multilingual-web-topic-format-base: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/Horizon-Labs/multilingual-web-topic-format-base/resolve/main/code/edu/build_label_in.py
- Command line
-
hf download hf://Horizon-Labs/multilingual-web-topic-format-base/code/edu/build_label_in.py
-
curl -L -o build_label_in.py https://huggingface.co/Horizon-Labs/multilingual-web-topic-format-base/resolve/main/code/edu/build_label_in.py
1.23 kB
| """Teacher-labelling input for the educational-quality classifier: | |
| - FineWeb-2 documents (edu/prep_fw.py train_docs), PER per language (English FineWeb docs excluded: English comes from Llama-3 annotations); | |
| - 10,000 documents from shard 0 of HuggingFaceFW/fineweb-edu-llama3-annotations with their Llama-3 score ('llama'), to fit the | |
| teacher -> Llama-3 calibration (edu/calibrate.py). | |
| python edu/build_label_in.py TRAIN_DOCS.parquet OUT.parquet [PER=2000]""" | |
| import os, sys | |
| import pandas as pd | |
| from huggingface_hub import hf_hub_download | |
| d = pd.read_parquet(sys.argv[1]); d = d[d.lang != "eng_Latn"] | |
| d = d.sample(frac=1, random_state=0).groupby("lang").head(int(os.environ.get("PER", 2000))).assign(source="fineweb2") | |
| l = pd.read_parquet(hf_hub_download("HuggingFaceFW/fineweb-edu-llama3-annotations", "data/train-00000-of-00008.parquet", repo_type="dataset"), columns=["text", "score"]) | |
| l = l.sample(10000, random_state=0).rename(columns={"score": "llama"}).assign(lang="eng_Latn", source="llama_calib"); l["text"] = l.text.str[:6000] | |
| o = pd.concat([d, l], ignore_index=True).sample(frac=1, random_state=0).reset_index(drop=True); o.to_parquet(sys.argv[2]) | |
| print(len(o), o.source.value_counts().to_dict(), o.lang.nunique()) | |