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:
Gustavo de Rosa 2024-04-17 13:46:25 +00:00 committed by system
parent b10c3eba54
commit 7e130907c9
No known key found for this signature in database
GPG Key ID: 6A528E38E0733467

@ -17,13 +17,7 @@ Our model hasn't been fine-tuned through reinforcement learning from human feedb
## 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:
* 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`.
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.
## Intended Uses
@ -103,7 +97,7 @@ inputs = tokenizer('''def print_prime(n):
"""''', return_tensors="pt", return_attention_mask=False)
outputs = model.generate(**inputs, max_length=200)
text = tokenizer.batch_decode(outputs)[0]
text = tokenizer.batch_decode(outputs[0])
print(text)
```