Readme: fix generation, update transformers version instructions (#121)
- Readme: fix generation, update transformers version instructions (96bc18c2e7946021a4f821caa7d6a32484bde76e) Co-authored-by: Pedro Cuenca <pcuenq@users.noreply.huggingface.co>
This commit is contained in:
parent
b10c3eba54
commit
7e130907c9
10
README.md
10
README.md
@ -17,13 +17,7 @@ Our model hasn't been fine-tuned through reinforcement learning from human feedb
|
|||||||
|
|
||||||
## How to Use
|
## How to Use
|
||||||
|
|
||||||
Phi-2 has been integrated in the development version (4.37.0.dev) of `transformers`. Until the official version is released through `pip`, ensure that you are doing one of the following:
|
Phi-2 was integrated in `transformers` version 4.37. If you need to use an earlier version, you need to pass `trust_remote_code=True` to the `from_pretrained()` function.
|
||||||
|
|
||||||
* When loading the model, ensure that `trust_remote_code=True` is passed as an argument of the `from_pretrained()` function.
|
|
||||||
|
|
||||||
* Update your local `transformers` to the development version: `pip uninstall -y transformers && pip install git+https://github.com/huggingface/transformers`. The previous command is an alternative to cloning and installing from the source.
|
|
||||||
|
|
||||||
The current `transformers` version can be verified with: `pip list | grep transformers`.
|
|
||||||
|
|
||||||
## Intended Uses
|
## Intended Uses
|
||||||
|
|
||||||
@ -103,7 +97,7 @@ inputs = tokenizer('''def print_prime(n):
|
|||||||
"""''', return_tensors="pt", return_attention_mask=False)
|
"""''', return_tensors="pt", return_attention_mask=False)
|
||||||
|
|
||||||
outputs = model.generate(**inputs, max_length=200)
|
outputs = model.generate(**inputs, max_length=200)
|
||||||
text = tokenizer.batch_decode(outputs)[0]
|
text = tokenizer.batch_decode(outputs[0])
|
||||||
print(text)
|
print(text)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user