raoufjat commited on
Commit
c4d5c18
1 Parent(s): 07c71da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -1,8 +1,12 @@
1
- # Use a pipeline as a high-level helper
2
- from transformers import pipeline
3
 
4
- messages = [
5
- {"role": "user", "content": "Who are you?"},
6
- ]
7
- pipe = pipeline("text-generation", model="Omartificial-Intelligence-Space/Arabic-QWQ-32B-Preview")
8
- pipe(messages)
 
 
 
 
 
 
1
+ from transformers import AutoModelForCausalLM, AutoTokenizer
 
2
 
3
+ # Load tokenizer and model manually
4
+ tokenizer = AutoTokenizer.from_pretrained("Omartificial-Intelligence-Space/Arabic-QWQ-32B-Preview")
5
+ model = AutoModelForCausalLM.from_pretrained("Omartificial-Intelligence-Space/Arabic-QWQ-32B-Preview")
6
+
7
+ # Manually perform text generation
8
+ inputs = tokenizer("Generate text example:", return_tensors="pt")
9
+ outputs = model.generate(**inputs, max_length=50)
10
+
11
+ # Decode the output
12
+ print(tokenizer.decode(outputs[0]))