AliMaatouk
commited on
Upload README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,88 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: text-generation
|
6 |
+
tags:
|
7 |
+
- nlp
|
8 |
+
---
|
9 |
+
|
10 |
+
# Phi-1.5-Tele Model Card
|
11 |
+
|
12 |
+
## Model Summary
|
13 |
+
|
14 |
+
The language model Phi-1.5-Tele is a Transformer with **1.3 billion** parameters, specialized in telecommunications. It is based on Microsoft [phi-1.5](https://huggingface.co/microsoft/phi-1_5) and was continutally pretrained on [Tele-Data](https://huggingface.co/datasets/AliMaatouk/Tele-Data), a large-scale dataset of approximately 2.5 billion tokens of telecommunications material, including articles, standards, and general web content related to the telecommunications domain.
|
15 |
+
|
16 |
+
When assessed against telecommunications benchmarks such as [Tele-Eval](https://huggingface.co/datasets/AliMaatouk/Tele-Eval), Phi-1.5-Tele outperforms [phi-1.5](https://huggingface.co/microsoft/phi-1_5) by several percentage points. Additionally, Phi-1.5-Tele matches [phi-1.5](https://huggingface.co/microsoft/phi-1_5) across benchmarks related to common sense, language understanding, and logical reasoning. Thus, this adaptation was achieved with minimal compromise in performance on the original version.
|
17 |
+
|
18 |
+
### Context Length
|
19 |
+
|
20 |
+
The model was trained on a context length of 2048 tokens.
|
21 |
+
|
22 |
+
## Usage
|
23 |
+
|
24 |
+
Phi-1.5-Tele is a base model best suited for fine-tuning on applications related to telecommunications. Although it has not been specifically fine-tuned to follow instructions, it can be prompted to answer questions and follow instructions using the following format:
|
25 |
+
|
26 |
+
```markdown
|
27 |
+
Write me a poem about telecommunications.
|
28 |
+
|
29 |
+
Answer: This world so vast and wide, we send our thoughts fast,
|
30 |
+
With technology that allows us to be ever part of it.
|
31 |
+
We connect, we share, we unite,
|
32 |
+
Through the web of information, so vast and complete.
|
33 |
+
```
|
34 |
+
|
35 |
+
where the model generates the text after "Answer:".
|
36 |
+
|
37 |
+
## Sample Code
|
38 |
+
|
39 |
+
Below we share some code snippets on how to get quickly started with running the model. First, make sure to `pip install -U transformers`, then copy the snippet corresponding to your hardware and adapt it to your usecase.
|
40 |
+
|
41 |
+
#### Running the model on a CPU
|
42 |
+
|
43 |
+
|
44 |
+
```python
|
45 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
46 |
+
|
47 |
+
model = AutoModelForCausalLM.from_pretrained("AliMaatouk/Phi-1.5-Tele", torch_dtype="auto")
|
48 |
+
tokenizer = AutoTokenizer.from_pretrained("AliMaatouk/Phi-1.5-Tele")
|
49 |
+
|
50 |
+
prompt = "Write me a poem about telecommunications.\nAnswer:"
|
51 |
+
input_ids = tokenizer(prompt, return_tensors="pt")
|
52 |
+
outputs = model.generate(**input_ids, max_new_tokens=100)
|
53 |
+
|
54 |
+
generated_tokens = outputs[0, len(input_ids['input_ids'][0]):]
|
55 |
+
response = tokenizer.decode(generated_tokens, skip_special_tokens=True)
|
56 |
+
print(response)
|
57 |
+
```
|
58 |
+
|
59 |
+
#### Running the model on a single / multi GPU
|
60 |
+
|
61 |
+
```python
|
62 |
+
import torch
|
63 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
64 |
+
|
65 |
+
model = AutoModelForCausalLM.from_pretrained("AliMaatouk/Phi-1.5-Tele", torch_dtype="auto", device_map="auto")
|
66 |
+
tokenizer = AutoTokenizer.from_pretrained("AliMaatouk/Phi-1.5-Tele")
|
67 |
+
|
68 |
+
prompt = "Write me a poem about telecommunications.\nAnswer:"
|
69 |
+
input_ids = tokenizer(prompt, return_tensors="pt").to("cuda")
|
70 |
+
outputs = model.generate(**input_ids, max_new_tokens=100)
|
71 |
+
|
72 |
+
generated_tokens = outputs[0, len(input_ids['input_ids'][0]):]
|
73 |
+
response = tokenizer.decode(generated_tokens, skip_special_tokens=True)
|
74 |
+
print(response)
|
75 |
+
```
|
76 |
+
|
77 |
+
## Citation
|
78 |
+
|
79 |
+
You can find the paper with all details about the model at https://arxiv.org/abs/2309.05463. Please cite it as follows:
|
80 |
+
|
81 |
+
```bib
|
82 |
+
@article{textbooks2,
|
83 |
+
title={Textbooks Are All You Need II: \textbf{phi-1.5} technical report},
|
84 |
+
author={Li, Yuanzhi and Bubeck, S{\'e}bastien and Eldan, Ronen and Del Giorno, Allie and Gunasekar, Suriya and Lee, Yin Tat},
|
85 |
+
journal={arXiv preprint arXiv:2309.05463},
|
86 |
+
year={2023}
|
87 |
+
}
|
88 |
+
```
|