damerajee commited on
Commit
1ef0387
1 Parent(s): a3112af

Update README.md

Browse files

Just added some more ways for people to play with it

Files changed (1) hide show
  1. README.md +21 -0
README.md CHANGED
@@ -8,6 +8,9 @@ This repository is the first model in the OpenHathi series of models that will b
8
  Note: this is a base model and not meant to be used as is. We recommend first finetuning it on task(s) you are interested in.
9
 
10
  ```
 
 
 
11
  # Usage
12
  tokenizer = AutoTokenizer.from_pretrained('sarvamai/OpenHathi-7B-Hi-v0.1-Base')
13
  model = LlamaForCausalLM.from_pretrained('sarvamai/OpenHathi-7B-Hi-v0.1-Base', torch_dtype=torch.bfloat16)
@@ -18,4 +21,22 @@ inputs = tokenizer(prompt, return_tensors="pt")
18
  # Generate
19
  generate_ids = model.generate(inputs.input_ids, max_length=30)
20
  tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  ```
 
8
  Note: this is a base model and not meant to be used as is. We recommend first finetuning it on task(s) you are interested in.
9
 
10
  ```
11
+ from transformers imprt AutoTokenizer,LlamaForCausalLM
12
+ import torch
13
+
14
  # Usage
15
  tokenizer = AutoTokenizer.from_pretrained('sarvamai/OpenHathi-7B-Hi-v0.1-Base')
16
  model = LlamaForCausalLM.from_pretrained('sarvamai/OpenHathi-7B-Hi-v0.1-Base', torch_dtype=torch.bfloat16)
 
21
  # Generate
22
  generate_ids = model.generate(inputs.input_ids, max_length=30)
23
  tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
24
+ ```
25
+
26
+ ## Streaming Options
27
+ ```
28
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer, pipeline
29
+ streamer = TextStreamer(tokenizer, skip_prompt=True)
30
+ pipe = pipeline(
31
+ "text-generation",
32
+ model=model,
33
+ tokenizer=tokenizer,
34
+ max_length=100,
35
+ temperature=0.7,
36
+ pad_token_id=tokenizer.eos_token_id,
37
+ top_p=0.95,
38
+ repetition_penalty=1.2,
39
+ streamer=streamer
40
+ )
41
+ pipe("सपनों को पंख दो, और जिन्दगी को हौसला।")
42
  ```