File size: 921 Bytes
b9ca884 | 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 | ---
license: mit
---
from pathlib import Path
from huggingface_hub import HfApi
repo_id = "rekhi/SLM"
readme = """---
library_name: pytorch
license: mit
tags:
- pytorch
- custom-model
- slm
pipeline_tag: text-generation
---
# SLM
Lightweight SLM weights (`slm_model.pt`).
> Replace this section with: architecture, training data, intended use, and limitations.
## Usage
```python
import torch
from huggingface_hub import hf_hub_download
# Download the file
ckpt_path = hf_hub_download(repo_id="rekhi/SLM", filename="slm_model.pt")
# 1) If this is a full torch model (saved with torch.save(model)):
model = torch.load(ckpt_path, map_location="cpu")
model.eval()
# 2) If this is a state_dict (saved with torch.save(model.state_dict())):
# Define your model class exactly as used in training, then:
# model = MyModel(**config)
# model.load_state_dict(torch.load(ckpt_path, map_location="cpu"))
# model.eval()
|