Updated README with PyTorch Lightning checkpoint instructions and improved usage examples
Browse files
README.md
CHANGED
|
@@ -70,9 +70,8 @@ pip install torch>=2.0.0 transformers>=4.35.0 huggingface-hub>=0.17.0
|
|
| 70 |
```python
|
| 71 |
from huggingface_hub import hf_hub_download
|
| 72 |
|
| 73 |
-
# Download model files
|
| 74 |
model_path = hf_hub_download(repo_id="Marks-lab/LOL-EVE", filename="pytorch_model.bin")
|
| 75 |
-
config_path = hf_hub_download(repo_id="Marks-lab/LOL-EVE", filename="config.json")
|
| 76 |
tokenizer_path = hf_hub_download(repo_id="Marks-lab/LOL-EVE", filename="tokenizer.json")
|
| 77 |
```
|
| 78 |
|
|
@@ -82,19 +81,15 @@ Since this model uses a custom architecture, you'll need to load it using PyTorc
|
|
| 82 |
|
| 83 |
```python
|
| 84 |
import torch
|
| 85 |
-
import json
|
| 86 |
|
| 87 |
-
# Load
|
| 88 |
-
with open(config_path, 'r') as f:
|
| 89 |
-
config = json.load(f)
|
| 90 |
-
|
| 91 |
-
# Load model state dict
|
| 92 |
model_state = torch.load(model_path, map_location='cpu')
|
| 93 |
|
| 94 |
-
print(f"Model type: {config['model_type']}")
|
| 95 |
-
print(f"Layers: {config['num_layers']}")
|
| 96 |
-
print(f"Embedding dimension: {config['num_embd']}")
|
| 97 |
print(f"Model parameters: {sum(p.numel() for p in model_state.values()):,}")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
```
|
| 99 |
|
| 100 |
## Testing the Model
|
|
|
|
| 70 |
```python
|
| 71 |
from huggingface_hub import hf_hub_download
|
| 72 |
|
| 73 |
+
# Download essential model files
|
| 74 |
model_path = hf_hub_download(repo_id="Marks-lab/LOL-EVE", filename="pytorch_model.bin")
|
|
|
|
| 75 |
tokenizer_path = hf_hub_download(repo_id="Marks-lab/LOL-EVE", filename="tokenizer.json")
|
| 76 |
```
|
| 77 |
|
|
|
|
| 81 |
|
| 82 |
```python
|
| 83 |
import torch
|
|
|
|
| 84 |
|
| 85 |
+
# Load model weights
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
model_state = torch.load(model_path, map_location='cpu')
|
| 87 |
|
|
|
|
|
|
|
|
|
|
| 88 |
print(f"Model parameters: {sum(p.numel() for p in model_state.values()):,}")
|
| 89 |
+
print(f"Model size: ~2.6GB")
|
| 90 |
+
|
| 91 |
+
# To use the model, you'll need to implement the LOLEVEForCausalLM class
|
| 92 |
+
# and load these weights into your model instance
|
| 93 |
```
|
| 94 |
|
| 95 |
## Testing the Model
|