tianbaoxiexxx
commited on
Commit
·
1f54b88
1
Parent(s):
86ba6fc
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
pipeline_tag: text-generation
|
3 |
+
inference: true
|
4 |
+
widget:
|
5 |
+
- text: 'def factorial(n):'
|
6 |
+
example_title: Factorial
|
7 |
+
group: Python
|
8 |
+
- text: 'def recur_fibo(n):'
|
9 |
+
example_title: Recursive Fibonacci
|
10 |
+
group: Python
|
11 |
+
license: llama2
|
12 |
+
library_name: transformers
|
13 |
+
tags:
|
14 |
+
- text-generation
|
15 |
+
- code
|
16 |
+
language:
|
17 |
+
- en
|
18 |
+
---
|
19 |
+
|
20 |
+
# lemur-70b-v1
|
21 |
+
|
22 |
+
<p align="center">
|
23 |
+
<img src="https://huggingface.co/datasets/OpenLemur/assets/resolve/main/lemur_icon.png" width="300" height="300" alt="Lemur">
|
24 |
+
</p>
|
25 |
+
|
26 |
+
|
27 |
+
## Model Summary
|
28 |
+
|
29 |
+
- **Repository:** [OpenLemur/lemur-v1](https://github.com/OpenLemur/lemur-v1)
|
30 |
+
- **Project Website:** [xlang.ai](https://www.xlang.ai/)
|
31 |
+
- **Paper:** [Coming soon](https://www.xlang.ai/)
|
32 |
+
- **Point of Contact:** [mail@xlang.ai](mailto:mail@xlang.ai)
|
33 |
+
|
34 |
+
## Use
|
35 |
+
|
36 |
+
### Setup
|
37 |
+
|
38 |
+
First, we have to install all the libraries listed in `requirements.txt` in [GitHub](https://github.com/OpenLemur/lemur-v1):
|
39 |
+
|
40 |
+
```bash
|
41 |
+
pip install -r requirements.txt
|
42 |
+
```
|
43 |
+
|
44 |
+
### Intended use
|
45 |
+
|
46 |
+
Since it is not trained on instruction following corpus, it won't respond well to questions like "What is the Python code to do quick sort?".
|
47 |
+
|
48 |
+
### Generation
|
49 |
+
|
50 |
+
```python
|
51 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
52 |
+
|
53 |
+
tokenizer = AutoTokenizer.from_pretrained("OpenLemur/lemur-70b-v1")
|
54 |
+
model = AutoModelForCausalLM.from_pretrained("OpenLemur/lemur-70b-v1", device_map="auto", load_in_8bit=True)
|
55 |
+
|
56 |
+
# Text Generation Example
|
57 |
+
prompt = "The world is "
|
58 |
+
input = tokenizer(prompt, return_tensors="pt")
|
59 |
+
output = model.generate(**input, max_length=50, num_return_sequences=1)
|
60 |
+
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
61 |
+
print(generated_text)
|
62 |
+
|
63 |
+
# Code Generation Example
|
64 |
+
prompt = """
|
65 |
+
def factorial(n):
|
66 |
+
if n == 0:
|
67 |
+
return 1
|
68 |
+
"""
|
69 |
+
input = tokenizer(prompt, return_tensors="pt")
|
70 |
+
output = model.generate(**input, max_length=200, num_return_sequences=1)
|
71 |
+
generated_code = tokenizer.decode(output[0], skip_special_tokens=True)
|
72 |
+
print(generated_code)
|
73 |
+
```
|
74 |
+
|
75 |
+
# License
|
76 |
+
The model is licensed under the Llama-2 community license agreement.
|