File size: 2,608 Bytes
a7c79e3 756c79e a7c79e3 756c79e a7c79e3 278bd0b a7c79e3 2e1e8cc 7cef6bf 2e1e8cc a7c79e3 a13626d 315bc58 a7c79e3 b857f5e a7c79e3 b857f5e a7c79e3 278bd0b 33da87b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
---
pipeline_tag: text-generation
inference: true
widget:
- text: "What's lemur's favorite fruit?"
example_title: Lemur favorite fruit
group: Python
- text: 'Write a Python function to merge two sorted lists into one sorted list without using any built-in sort functions.'
example_title: Merge Sort
group: Python
license: cc-by-nc-4.0
library_name: transformers
tags:
- text-generation
- code
- text-generation-inference
language:
- en
---
# lemur-70b-chat-v1
<p align="center">
<img src="https://huggingface.co/datasets/OpenLemur/assets/resolve/main/lemur_icon.png" width="300" height="300" alt="Lemur">
</p>
<div align="center">
<img src="https://huggingface.co/datasets/OpenLemur/assets/resolve/main/lemur_chat_radar.png">
</div>
📄Paper: https://arxiv.org/abs/2310.06830
👩💻Code: https://github.com/OpenLemur/Lemur
## Use
### Setup
First, we have to install all the libraries listed in `requirements.txt` in [GitHub](https://github.com/OpenLemur/lemur-v1):
```bash
pip install -r requirements.txt
```
### Generation
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("OpenLemur/lemur-70b-chat-v1")
model = AutoModelForCausalLM.from_pretrained("OpenLemur/lemur-70b-chat-v1", device_map="auto", load_in_8bit=True)
# Text Generation Example
prompt = """<|im_start|>system
You are a helpful, respectful, and honest assistant.
<|im_end|>
<|im_start|>user
What's a lemur's favorite fruit?<|im_end|>
<|im_start|>assistant
"""
input = tokenizer(prompt, return_tensors="pt")
output = model.generate(**input, max_length=50, num_return_sequences=1)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)
# Code Generation Example
prompt = """<|im_start|>system
Below is an instruction that describes a task. Write a response that appropriately completes the request.
<|im_end|>
<|im_start|>user
Write a Python function to merge two sorted lists into one sorted list without using any built-in sort functions.<|im_end|>
<|im_start|>assistant
"""
input = tokenizer(prompt, return_tensors="pt")
output = model.generate(**input, max_length=200, num_return_sequences=1)
generated_code = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_code)
```
# License
The model is licensed under a CC BY-NC-4.0 license focused on research use cases.
# Acknowledgements
The Lemur project is an open collaborative research effort between [XLang Lab](https://www.xlang.ai/) and Salesforce Research. We thank Salesforce, Google Research and Amazon AWS for their gift support.
|