Spaces:
Sleeping
Sleeping
Zai
commited on
Commit
·
f14ba46
1
Parent(s):
19307df
test space
Browse files- .github/workflows/hugging-face.yaml +1 -3
- README.md +13 -0
- burmesegpt/__init__.py +1 -1
- burmesegpt/{main.py → core.py} +23 -10
- burmesegpt/data_prep.py +3 -3
- burmesegpt/utils.py +0 -18
- requirements.txt +1 -0
.github/workflows/hugging-face.yaml
CHANGED
@@ -15,6 +15,4 @@ jobs:
|
|
15 |
- name: Push to hub
|
16 |
env:
|
17 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
18 |
-
|
19 |
-
SPACE_NAME: yume
|
20 |
-
run: git push https://${{ secrets.HF_USERNAME }}:[email protected]/spaces/$HF_USERNAME/$SPACE_NAME main
|
|
|
15 |
- name: Push to hub
|
16 |
env:
|
17 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
18 |
+
run: git push https://zaibutcooler:[email protected]/spaces/zaibutcooler/burmese-gpt main
|
|
|
|
README.md
CHANGED
@@ -1 +1,14 @@
|
|
1 |
# Burmese GPT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Burmese GPT
|
2 |
+
|
3 |
+
---
|
4 |
+
|
5 |
+
title: BurmeseGPT
|
6 |
+
emoji: ✨
|
7 |
+
colorFrom: yellow
|
8 |
+
colorTo: blue
|
9 |
+
sdk: streamlit
|
10 |
+
sdk_version: 1.29.0
|
11 |
+
app_file: space.py
|
12 |
+
pinned: false
|
13 |
+
license: openrail
|
14 |
+
---
|
burmesegpt/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1 |
-
from .
|
|
|
1 |
+
from .core import BurmeseGpt
|
burmesegpt/{main.py → core.py}
RENAMED
@@ -1,4 +1,6 @@
|
|
1 |
import torch
|
|
|
|
|
2 |
from .models import SelfAttention,MLP,GPT
|
3 |
from .tokenizer import Tokenizer
|
4 |
from .config import Config
|
@@ -16,18 +18,29 @@ class BurmeseGpt:
|
|
16 |
self.train_data = Data().to(device)
|
17 |
self.tokenizer = tk
|
18 |
|
19 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
pass
|
21 |
|
22 |
def generate(self,entry=''):
|
23 |
result = None
|
24 |
|
25 |
-
return result
|
26 |
-
|
27 |
-
def save_trained(self):
|
28 |
-
pass
|
29 |
-
|
30 |
-
def load_pretrained(self,name=""):
|
31 |
-
pass
|
32 |
-
|
33 |
-
|
|
|
1 |
import torch
|
2 |
+
from huggingface_hub import login
|
3 |
+
|
4 |
from .models import SelfAttention,MLP,GPT
|
5 |
from .tokenizer import Tokenizer
|
6 |
from .config import Config
|
|
|
18 |
self.train_data = Data().to(device)
|
19 |
self.tokenizer = tk
|
20 |
|
21 |
+
def save_pretrained(self, name="burmese-gpt"):
|
22 |
+
print("Uploading model...")
|
23 |
+
self.model.save_pretrained(name)
|
24 |
+
print(f"Model saved locally as '{name}'")
|
25 |
+
self.model.push_to_hub(name)
|
26 |
+
print(f"Model '{name}' uploaded to the Hugging Face Model Hub")
|
27 |
+
|
28 |
+
def load_pretrained(self, model_id="zaibutcooler/burmese-gpt"):
|
29 |
+
print("Loading model...")
|
30 |
+
model = model.from_pretrained(model_id)
|
31 |
+
print(f"Model '{model_id}' loaded successfully")
|
32 |
+
return model
|
33 |
+
|
34 |
+
def huggingface_login(self,token):
|
35 |
+
login(token)
|
36 |
+
|
37 |
+
def pretrain(self):
|
38 |
+
pass
|
39 |
+
|
40 |
+
def fine_tune(self):
|
41 |
pass
|
42 |
|
43 |
def generate(self,entry=''):
|
44 |
result = None
|
45 |
|
46 |
+
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
burmesegpt/data_prep.py
CHANGED
@@ -2,12 +2,12 @@
|
|
2 |
from datasets import load_dataset
|
3 |
from torch.utils.data import Dataset
|
4 |
|
5 |
-
dataset = load_dataset("")
|
6 |
|
7 |
class Data(Dataset):
|
8 |
-
def __init__(self
|
9 |
super().__init__()
|
10 |
-
self.
|
|
|
11 |
|
12 |
def __len__(self):
|
13 |
return None
|
|
|
2 |
from datasets import load_dataset
|
3 |
from torch.utils.data import Dataset
|
4 |
|
|
|
5 |
|
6 |
class Data(Dataset):
|
7 |
+
def __init__(self):
|
8 |
super().__init__()
|
9 |
+
self.texts = None
|
10 |
+
self.data
|
11 |
|
12 |
def __len__(self):
|
13 |
return None
|
burmesegpt/utils.py
CHANGED
@@ -5,21 +5,3 @@ def get_stats():
|
|
5 |
|
6 |
def merge():
|
7 |
pass
|
8 |
-
|
9 |
-
def upload_model(model, name="", token=""):
|
10 |
-
print("Uploading model...")
|
11 |
-
model.save_pretrained(name)
|
12 |
-
print(f"Model saved locally as '{name}'")
|
13 |
-
model.push_to_hub(name)
|
14 |
-
print(f"Model '{name}' uploaded to the Hugging Face Model Hub")
|
15 |
-
|
16 |
-
def save_model(model, name="gpt"):
|
17 |
-
print("Saving model...")
|
18 |
-
model.save_pretrained(name)
|
19 |
-
print(f"Model saved locally as '{name}'")
|
20 |
-
|
21 |
-
def load_model(model_name):
|
22 |
-
print("Loading model...")
|
23 |
-
model = model.from_pretrained(model_name)
|
24 |
-
print(f"Model '{model_name}' loaded successfully")
|
25 |
-
return model
|
|
|
5 |
|
6 |
def merge():
|
7 |
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
streamlit
|