File size: 1,210 Bytes
5816477 4454b05 5816477 4454b05 5816477 4454b05 5816477 8c770c5 4454b05 8c770c5 a244579 8c770c5 a244579 8c770c5 4454b05 |
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 |
---
license: other
pipeline_tag: text-generation
tags:
- sharded
- yi
- bf16
- colab
---
# Yi-6B-200K-Llama - sharded bf16
https://huggingface.co/chargoddard/Yi-6B-200K-Llama sharded & in bf16 (colab free GPU loadable)
Please note the custom license from [the original](https://huggingface.co/01-ai/Yi-6B-200K) still applies 🌝
```python
# !pip install -U -q transformers accelerate sentencepiece bitsandbytes
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained(
"pszemraj/Yi-6B-200K-Llama-sharded", use_fast=False
)
model = AutoModelForCausalLM.from_pretrained(
"pszemraj/Yi-6B-200K-Llama-sharded", load_in_4bit=True
)
prompt = "Custom non-commercial software licenses are just so fun, aren't they? The best thing about them is"
if torch.cuda.is_available():
torch.cuda.empty_cache()
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
tokens = model.generate(
**inputs,
max_new_tokens=192,
temperature=0.75,
top_p=0.9,
no_repeat_ngram_size=4,
do_sample=True,
renormalize_logits=True,
repetition_penalty=1.05,
)
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
``` |