nouamanetazi HF staff commited on
Commit
da3b2d5
·
verified ·
1 Parent(s): ebbe229

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -0
README.md CHANGED
@@ -4,3 +4,21 @@ pipeline_tag: text-generation
4
  language:
5
  - ar
6
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  language:
5
  - ar
6
  ---
7
+
8
+ # 1p46G-gemma-fp-dedup-rehydr-ar-350BT-seed-6/transformers/134000
9
+
10
+ Tokenizer: `google/gemma-7b`
11
+
12
+ ```python
13
+ from transformers import AutoTokenizer, AutoModelForCausalLM
14
+ # Initialize model and tokenizer
15
+ TEST_PROMPT = "الزرادشتية هي ديانة انتشرت في بلاد"
16
+ save_path = "nouamanetazi/hf-ar-134000"
17
+ tokenizer = AutoTokenizer.from_pretrained(save_path)
18
+ input_ids = tokenizer(TEST_PROMPT, return_tensors="pt")["input_ids"].cuda() # google/gemma-7b
19
+ print("Input prompt:", tokenizer.batch_decode(input_ids)[0])
20
+
21
+ model = AutoModelForCausalLM.from_pretrained(save_path, device="cuda", dtype=torch.bfloat16)
22
+ outputs = model.generate(input_ids, max_new_tokens=100)
23
+ print("Generated text:", tokenizer.batch_decode(outputs)[0])
24
+ ```