erfanzar commited on
Commit
b3f4be0
1 Parent(s): e7c8cf4

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +89 -0
README.md ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - OpenAssistant/oasst1
5
+ - erfanzar/CC-H2OAI-OASST-1-TRAIN
6
+ - erfanzar/CC-OASST-1-TRAIN
7
+ language:
8
+ - en
9
+ - fr
10
+ - fa
11
+ - nl
12
+ metrics:
13
+ - bertscore
14
+ pipeline_tag: text-generation
15
+ ---
16
+
17
+
18
+ ## Hello community
19
+
20
+ this model is only 1B but you can call it somehow an SOTA
21
+
22
+
23
+ this model can also run on 4 GB GPU RAM and know dialogs as well
24
+
25
+ ## Usage Code
26
+
27
+ ```python
28
+
29
+ from transformers import AutoTokenizer, AutoModelForCausalLM
30
+ from IPython.display import clear_output
31
+ import textwrap
32
+
33
+
34
+ tokenizer = AutoTokenizer.from_pretrained("erfanzar/PGT-1B-2EP")
35
+
36
+ model = AutoModelForCausalLM.from_pretrained("erfanzar/PGT-1B-2EP",device_map='auto',load_in_8bit=True)
37
+
38
+
39
+ verify_text = lambda txt : '\n'.join([textwrap.fill(txt, width=140) for txt in txt.split('\n')])
40
+
41
+
42
+ def ppp(text:str):
43
+ """
44
+ pre processing prompt
45
+ """
46
+ return f"<|prompter|>{text}<|endoftext|><|assistant|>"
47
+
48
+ def generate(text,max_new_tokens:int=512,use_ppp:bool=False,b_pair=False):
49
+ text = ppp(text) if use_ppp else text
50
+
51
+ for i in range(max_new_tokens):
52
+ enc = tokenizer(text,return_tensors='pt')
53
+ text_r = text
54
+ enc = model.generate(**enc,max_new_tokens=1,pad_token_id=0)
55
+ text = tokenizer.decode(enc[0])
56
+ if text.endswith(tokenizer.eos_token):
57
+ break
58
+ else:
59
+ yield text[len(text_r):] if b_pair else text
60
+
61
+ for v in generate('where is empire building ?',512,True):
62
+ clear_output(wait=True)
63
+ print(verify_text(v),end='')
64
+
65
+ ```
66
+
67
+ # Pythia-1B
68
+
69
+ ## Model Details
70
+
71
+ ### Pretrained Model
72
+
73
+ - Developed by: [EleutherAI](http://eleuther.ai)
74
+ - Model type: Transformer-based Language Model
75
+ - FineTuned Languages: English , Persian , French, And Dutch
76
+ - Learn more: [Pythia's GitHub repository](https://github.com/EleutherAI/pythia) for training procedures, config files, and details on how to use.
77
+ - Library: [GPT-NeoX](https://github.com/EleutherAI/gpt-neox)
78
+ - License: [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
79
+
80
+
81
+
82
+ ## NOTE
83
+
84
+ The Pythia Suite is **NOT** intended for deployment. It is not in itself
85
+ a product and cannot be used for human-facing interactions. For example,
86
+ the model may generate harmful or offensive text...
87
+
88
+
89
+ and also remember that this model is not good enough for Persian, French, and Dutch at least for this version