sagorsarker commited on
Commit
7fc2b28
1 Parent(s): e9e1766

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +23 -1
README.md CHANGED
@@ -56,5 +56,27 @@ Install the following library before running the code:
56
  - pip install accelerate
57
 
58
  ```py
59
- # code will add soon
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  ```
 
56
  - pip install accelerate
57
 
58
  ```py
59
+ import transformers
60
+ from transformers import pipeline
61
+
62
+ name = 'hishab/titulm-1b-bn-v1'
63
+
64
+ config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
65
+ config.max_seq_len = 2048
66
+
67
+ model = transformers.AutoModelForCausalLM.from_pretrained(
68
+ name,
69
+ config=config,
70
+ trust_remote_code=True
71
+ )
72
+
73
+ tokenizer = transformers.AutoTokenizer.from_pretrained('hishab/titulm-1b-bn-v1')
74
+
75
+ pipe = pipeline('text-generation', model=model, tokenizer=tokenizer, device='cuda:0')
76
+ output = pipe('আমি বাংলায় গান\n',
77
+ max_new_tokens=100,
78
+ do_sample=True,
79
+ use_cache=True)
80
+
81
+ print(output)
82
  ```