File size: 2,482 Bytes
4655dd2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | # 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
```bash
# 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.5b` → `Load`.
### 2. Direct HF Hub Loading (coming)
Set in `ModelLoader`:
```json
{"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:
```python
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 `/benchmark` → `Custom` → 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
|