RobbiePasquale
commited on
Commit
•
8611bfd
1
Parent(s):
99045de
Update README.md
Browse files
README.md
CHANGED
@@ -62,6 +62,78 @@ This model is designed for text generation tasks such as:
|
|
62 |
|
63 |
---
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
## How to Use
|
66 |
### Installation
|
67 |
Ensure you have the following libraries installed:
|
|
|
62 |
|
63 |
---
|
64 |
|
65 |
+
|
66 |
+
|
67 |
+
#### Load Files from the Repository
|
68 |
+
You can use the `from_pretrained` method to load specific files or weights:
|
69 |
+
```python
|
70 |
+
from transformers import AutoTokenizer, AutoModel
|
71 |
+
import torch
|
72 |
+
|
73 |
+
# Load the tokenizer (if applicable)
|
74 |
+
tokenizer = AutoTokenizer.from_pretrained("RobbiePasquale/gpt-moe-mcts")
|
75 |
+
|
76 |
+
# Load model weights
|
77 |
+
model = torch.hub.load("RobbiePasquale/gpt-moe-mcts", "GPTWithMoE")
|
78 |
+
|
79 |
+
# Use tokenizer and model
|
80 |
+
prompt = "Once upon a time in a distant galaxy,"
|
81 |
+
input_ids = tokenizer.encode(prompt, return_tensors="pt")
|
82 |
+
|
83 |
+
# Generate output (if model is compatible with Hugging Face architecture)
|
84 |
+
output = model.generate(input_ids, max_length=50)
|
85 |
+
print(tokenizer.decode(output[0]))
|
86 |
+
```
|
87 |
+
|
88 |
+
---
|
89 |
+
|
90 |
+
### **Using `huggingface_hub` for Direct Access to Files**
|
91 |
+
The `huggingface_hub` library allows users to download individual files or clone the repository.
|
92 |
+
|
93 |
+
#### 1. Install the Library
|
94 |
+
```bash
|
95 |
+
pip install huggingface_hub
|
96 |
+
```
|
97 |
+
|
98 |
+
#### 2. Clone the Repository
|
99 |
+
You can clone the repository to access all files in the directory:
|
100 |
+
```bash
|
101 |
+
from huggingface_hub import snapshot_download
|
102 |
+
|
103 |
+
# Download repository files
|
104 |
+
repo_path = snapshot_download(repo_id="RobbiePasquale/gpt-moe-mcts")
|
105 |
+
|
106 |
+
print(f"Repository downloaded to {repo_path}")
|
107 |
+
```
|
108 |
+
This will download all files from the repository, including:
|
109 |
+
- `moe_mcts_new.pt`
|
110 |
+
- `q_star.py`
|
111 |
+
- `mcts_text_gen.py`
|
112 |
+
|
113 |
+
The files will be saved locally in a directory structure matching the repository.
|
114 |
+
|
115 |
+
#### 3. Load Specific Files
|
116 |
+
To load individual files programmatically:
|
117 |
+
```python
|
118 |
+
from huggingface_hub import hf_hub_download
|
119 |
+
|
120 |
+
# Download specific file
|
121 |
+
weights_path = hf_hub_download(repo_id="RobbiePasquale/gpt-moe-mcts", filename="moe_mcts_new.pt")
|
122 |
+
print(f"Downloaded weights to {weights_path}")
|
123 |
+
```
|
124 |
+
|
125 |
+
---
|
126 |
+
|
127 |
+
### **Command-Line Access**
|
128 |
+
You can also clone the repository using Git:
|
129 |
+
```bash
|
130 |
+
git lfs install
|
131 |
+
git clone https://huggingface.co/RobbiePasquale/gpt-moe-mcts
|
132 |
+
```
|
133 |
+
|
134 |
+
---
|
135 |
+
|
136 |
+
|
137 |
## How to Use
|
138 |
### Installation
|
139 |
Ensure you have the following libraries installed:
|