Update README.md
Browse files
README.md
CHANGED
|
@@ -80,6 +80,8 @@ def preprocess_text(text):
|
|
| 80 |
|
| 81 |
|
| 82 |
# Step 3: Load the model and tokenizer from Hugging Face Hub
|
|
|
|
|
|
|
| 83 |
```python
|
| 84 |
print("Loading model and tokenizer...")
|
| 85 |
REPO_NAME = "CIS5190GoGo/CustomModel" #This is where we pushed the model to
|
|
@@ -94,7 +96,7 @@ print("Model and tokenizer loaded successfully!")
|
|
| 94 |
# Step 4: Load test dataset
|
| 95 |
```python
|
| 96 |
print("Loading test data...")
|
| 97 |
-
test_data_path = "
|
| 98 |
test_data = pd.read_csv(test_data_path)
|
| 99 |
```
|
| 100 |
# Step 5: Preprocess test data
|
|
@@ -129,4 +131,30 @@ with torch.no_grad():
|
|
| 129 |
|
| 130 |
accuracy = accuracy_score(all_labels, all_preds)
|
| 131 |
print(f"Test Accuracy: {accuracy:.4f}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
```
|
|
|
|
| 80 |
|
| 81 |
|
| 82 |
# Step 3: Load the model and tokenizer from Hugging Face Hub
|
| 83 |
+
This step loads the pre-trained model and tokenizer, which are hosted on the Hugging Face Hub.
|
| 84 |
+
|
| 85 |
```python
|
| 86 |
print("Loading model and tokenizer...")
|
| 87 |
REPO_NAME = "CIS5190GoGo/CustomModel" #This is where we pushed the model to
|
|
|
|
| 96 |
# Step 4: Load test dataset
|
| 97 |
```python
|
| 98 |
print("Loading test data...")
|
| 99 |
+
test_data_path = "Replace wit your test set path" #Note: Replace with your test set path
|
| 100 |
test_data = pd.read_csv(test_data_path)
|
| 101 |
```
|
| 102 |
# Step 5: Preprocess test data
|
|
|
|
| 131 |
|
| 132 |
accuracy = accuracy_score(all_labels, all_preds)
|
| 133 |
print(f"Test Accuracy: {accuracy:.4f}")
|
| 134 |
+
```
|
| 135 |
+
# Expected output:
|
| 136 |
+
```python
|
| 137 |
+
Loading model and tokenizer...
|
| 138 |
+
/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_auth.py:94: UserWarning:
|
| 139 |
+
The secret `HF_TOKEN` does not exist in your Colab secrets.
|
| 140 |
+
To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.
|
| 141 |
+
You will be able to reuse this secret in all of your notebooks.
|
| 142 |
+
Please note that authentication is recommended but still optional to access public models or datasets.
|
| 143 |
+
warnings.warn(
|
| 144 |
+
config.json:β100%
|
| 145 |
+
β735/735β[00:00<00:00,β40.8kB/s]
|
| 146 |
+
model.safetensors:β100%
|
| 147 |
+
β499M/499Mβ[00:11<00:00,β42.7MB/s]
|
| 148 |
+
tokenizer_config.json:β100%
|
| 149 |
+
β1.19k/1.19kβ[00:00<00:00,β69.8kB/s]
|
| 150 |
+
vocab.json:β100%
|
| 151 |
+
β999k/999kβ[00:00<00:00,β4.09MB/s]
|
| 152 |
+
merges.txt:β100%
|
| 153 |
+
β456k/456kβ[00:00<00:00,β2.61MB/s]
|
| 154 |
+
special_tokens_map.json:β100%
|
| 155 |
+
β958/958β[00:00<00:00,β57.4kB/s]
|
| 156 |
+
Model and tokenizer loaded successfully!
|
| 157 |
+
Loading test data...
|
| 158 |
+
Evaluating the model...
|
| 159 |
+
Test Accuracy: 0.8500
|
| 160 |
```
|