Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -47,9 +47,12 @@ Combines multitask intent modeling, supervised IAB content classification, and p
|
|
| 47 |
|
| 48 |
```python
|
| 49 |
!pip -q install -U pip
|
| 50 |
-
!pip -q install -U "torch
|
|
|
|
| 51 |
```
|
| 52 |
|
|
|
|
|
|
|
| 53 |
```python
|
| 54 |
from transformers import pipeline
|
| 55 |
|
|
@@ -66,6 +69,20 @@ print(out["model_output"]["classification"]["intent"])
|
|
| 66 |
|
| 67 |
---
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
### 1. `transformers.pipeline()` — anywhere (Python)
|
| 70 |
|
| 71 |
```python
|
|
|
|
| 47 |
|
| 48 |
```python
|
| 49 |
!pip -q install -U pip
|
| 50 |
+
!pip -q install -U "torch==2.10.0" "torchvision==0.25.0" "torchaudio==2.10.0"
|
| 51 |
+
!pip -q install -U "transformers>=4.36.0" "huggingface_hub>=0.20.0" "safetensors>=0.4.0"
|
| 52 |
```
|
| 53 |
|
| 54 |
+
Restart the runtime after installs (**Runtime → Restart runtime**) so the new Torch version is actually used.
|
| 55 |
+
|
| 56 |
```python
|
| 57 |
from transformers import pipeline
|
| 58 |
|
|
|
|
| 69 |
|
| 70 |
---
|
| 71 |
|
| 72 |
+
## Latency / inference timing (quick check)
|
| 73 |
+
|
| 74 |
+
The first call includes model/code loading. Warm up once, then measure:
|
| 75 |
+
|
| 76 |
+
```python
|
| 77 |
+
import time
|
| 78 |
+
q = "Which laptop should I buy for college?"
|
| 79 |
+
|
| 80 |
+
_ = clf("warm up")
|
| 81 |
+
t0 = time.perf_counter()
|
| 82 |
+
out = clf(q)
|
| 83 |
+
print(f"latency_ms={(time.perf_counter() - t0) * 1000:.1f}")
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
### 1. `transformers.pipeline()` — anywhere (Python)
|
| 87 |
|
| 88 |
```python
|