Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ import os
|
|
| 8 |
sys.path.append(os.path.join(os.path.dirname(__file__), "model"))
|
| 9 |
from modeling_ngwanda import NgwandaModel
|
| 10 |
|
| 11 |
-
# Load the wrapped tokenizer
|
| 12 |
tokenizer = LlamaTokenizer.from_pretrained("./ngwanda-tokenizer-hf")
|
| 13 |
# Load your Ngwanda base model
|
| 14 |
model = NgwandaModel.from_pretrained("./model")
|
|
@@ -35,8 +35,8 @@ def predict(text, tokens, temp):
|
|
| 35 |
# Gradio Interface (Text Completion style)
|
| 36 |
gr.Interface(
|
| 37 |
fn=predict,
|
| 38 |
-
inputs=[gr.Textbox(label="Shona
|
| 39 |
outputs="text",
|
| 40 |
-
title="
|
| 41 |
description="A base language model for Shona."
|
| 42 |
).launch()
|
|
|
|
| 8 |
sys.path.append(os.path.join(os.path.dirname(__file__), "model"))
|
| 9 |
from modeling_ngwanda import NgwandaModel
|
| 10 |
|
| 11 |
+
# Load the wrapped tokenizer
|
| 12 |
tokenizer = LlamaTokenizer.from_pretrained("./ngwanda-tokenizer-hf")
|
| 13 |
# Load your Ngwanda base model
|
| 14 |
model = NgwandaModel.from_pretrained("./model")
|
|
|
|
| 35 |
# Gradio Interface (Text Completion style)
|
| 36 |
gr.Interface(
|
| 37 |
fn=predict,
|
| 38 |
+
inputs=[gr.Textbox(label="Shona Input"), gr.Slider(10, 200, value=50, step=1, label="Max New Tokens"), gr.Slider(0.1, 1.0, value=0.7, step=0.1, label="Temperature")],
|
| 39 |
outputs="text",
|
| 40 |
+
title="Ngwanda Base Model",
|
| 41 |
description="A base language model for Shona."
|
| 42 |
).launch()
|
model/__pycache__/configuration_ngwanda.cpython-314.pyc
CHANGED
|
Binary files a/model/__pycache__/configuration_ngwanda.cpython-314.pyc and b/model/__pycache__/configuration_ngwanda.cpython-314.pyc differ
|
|
|
model/__pycache__/constants.cpython-314.pyc
CHANGED
|
Binary files a/model/__pycache__/constants.cpython-314.pyc and b/model/__pycache__/constants.cpython-314.pyc differ
|
|
|
model/__pycache__/modeling_ngwanda.cpython-314.pyc
CHANGED
|
Binary files a/model/__pycache__/modeling_ngwanda.cpython-314.pyc and b/model/__pycache__/modeling_ngwanda.cpython-314.pyc differ
|
|
|
model/modeling_ngwanda.py
CHANGED
|
@@ -18,6 +18,7 @@ class NgwandaModel(PreTrainedModel):
|
|
| 18 |
V=config.vocab_size,
|
| 19 |
layers=config.layers
|
| 20 |
)
|
|
|
|
| 21 |
|
| 22 |
def forward(self, input_ids, **kwargs):
|
| 23 |
logits, _ = self.transformer(input_ids)
|
|
|
|
| 18 |
V=config.vocab_size,
|
| 19 |
layers=config.layers
|
| 20 |
)
|
| 21 |
+
self.post_init()
|
| 22 |
|
| 23 |
def forward(self, input_ids, **kwargs):
|
| 24 |
logits, _ = self.transformer(input_ids)
|