Unverified Commit fff8ca8e authored by Susnato Dhar's avatar Susnato Dhar Committed by GitHub
Browse files

update docs to add the `phi-2` example (#28392)

* update docs

* added Tip
parent ee2482b6
...@@ -64,6 +64,8 @@ promote further research on these urgent topics.* ...@@ -64,6 +64,8 @@ promote further research on these urgent topics.*
This model was contributed by [Susnato Dhar](https://huggingface.co/susnato). This model was contributed by [Susnato Dhar](https://huggingface.co/susnato).
The original code for Phi-1 and Phi-1.5 can be found [here](https://huggingface.co/microsoft/phi-1/blob/main/modeling_mixformer_sequential.py) and [here](https://huggingface.co/microsoft/phi-1_5/blob/main/modeling_mixformer_sequential.py) respectively. The original code for Phi-1 and Phi-1.5 can be found [here](https://huggingface.co/microsoft/phi-1/blob/main/modeling_mixformer_sequential.py) and [here](https://huggingface.co/microsoft/phi-1_5/blob/main/modeling_mixformer_sequential.py) respectively.
The original code for Phi-2 can be found [here](https://huggingface.co/microsoft/phi-2).
## Usage tips ## Usage tips
...@@ -71,6 +73,29 @@ The original code for Phi-1 and Phi-1.5 can be found [here](https://huggingface. ...@@ -71,6 +73,29 @@ The original code for Phi-1 and Phi-1.5 can be found [here](https://huggingface.
- The tokenizer used for this model is identical to the [`CodeGenTokenizer`]. - The tokenizer used for this model is identical to the [`CodeGenTokenizer`].
## How to use Phi-2
<Tip warning={true}>
The current weights at [microsoft/phi-2](https://huggingface.co/microsoft/phi-2) are not in proper order to be used with the library model. Until that is resolved, please use [susnato/phi-2](https://huggingface.co/susnato/phi-2) to load using the library `phi` model.
</Tip>
```python
>>> from transformers import AutoModelForCausalLM, AutoTokenizer
>>> model = AutoModelForCausalLM.from_pretrained("susnato/phi-2")
>>> tokenizer = AutoTokenizer.from_pretrained("susnato/phi-2")
>>> inputs = tokenizer('Can you help me write a formal email to a potential business partner proposing a joint venture?', return_tensors="pt", return_attention_mask=False)
>>> outputs = model.generate(**inputs, max_length=30)
>>> text = tokenizer.batch_decode(outputs)[0]
>>> print(text)
'Can you help me write a formal email to a potential business partner proposing a joint venture?\nInput: Company A: ABC Inc.\nCompany B: XYZ Ltd.\nJoint Venture: A new online platform for e-commerce'
```
### Example : ### Example :
```python ```python
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment