platform-test-models / docs /HUGGINGFACE.md
ISLAM-PO's picture
Upload 861 files
4655dd2 verified
|
Raw
History Blame Contribute Delete
2.48 kB

Hugging Face Integration

For Engineers & Developers

This platform is model-agnostic and works with any Hugging Face model that provides Safetensors weights.

1. Use a HF Model Locally

# Option A: git lfs
git lfs install
git clone https://huggingface.co/Qwen/Qwen2-1.5B-Instruct ./C:/models/qwen2-1.5b
# Option B: huggingface_hub
pip install huggingface_hub
huggingface-cli download Qwen/Qwen2-1.5B-Instruct --local-dir C:/models/qwen2-1.5b --local-dir-use-symlinks False

Then in UI paste C:\models\qwen2-1.5bLoad.

2. Direct HF Hub Loading (coming)

Set in ModelLoader:

{"model_path":"Qwen/Qwen2-1.5B-Instruct","dtype":"float16","quantization":"4bit"}

Requires trust_remote_code if model uses custom code.

3. Datasets for Custom Benchmark

Export any HF dataset to the folder format:

from datasets import load_dataset
ds = load_dataset("MMLU", "arabic")
# Convert to CSV: prompt,expected,category
import csv
with open("C:/data/mmlu_ar.csv","w",encoding="utf-8",newline="") as f:
    w=csv.writer(f); w.writerow(["prompt","expected","category"])
    for row in ds["test"]:
        w.writerow([row["question"], row["answer"], "reasoning"])

Then use /benchmarkCustom → scan C:/data.

4. Model Card Template (for your model on HF)

Create README.md on HF with: ```markdown

language: [en, ar] license: mit tags: [safetensors, qwen2, arabic, benchmark]

My Model - Evaluated with Safetensors Studio & Bench

  • Benchmark: 15 tasks (Reasoning/Coding/Arabic/Summarization)
  • Accuracy: 92.3% (see PDF report)
  • VRAM Peak: 4200 MB (float16)
  • TPS: 18.4 (A100) Evaluated locally on Safetensors Studio & Bench v1.0. Report: [share link]

### 5. Publishing Your Benchmark Report
- Run benchmark → `Share` → copy `/share/{token}` → paste in HF model card or discussion
- Export `PDF` and upload as `evaluation.pdf` to the model repo

### 6. For HF Space Deployment
This repo can be deployed as a HF Space (Docker):
```dockerfile
FROM python:3.12
COPY backend/ ./backend
RUN pip install -r backend/requirements.txt
COPY frontend/out ./frontend/out
CMD ["uvicorn","app.main:app","--host","0.0.0.0","--port","7860"]

Space README.md: ```yaml

title: Safetensors Studio emoji: 🧪 colorFrom: violet sdk: docker app_port: 7860


### 7. Community
- Tag issues with `hf` for Hub-related features
- Share your custom `example_dataset/` as a HF Dataset for others