Spaces:
Runtime error
Runtime error
Brajananda Mahata
commited on
Commit
β’
175bb8d
1
Parent(s):
4ebc27f
hello world
Browse files- app.py +29 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer
|
2 |
+
import transformers
|
3 |
+
import torch
|
4 |
+
import gradio as gr
|
5 |
+
|
6 |
+
model= "PY007/TinyLlama-1.1B-step-50K-105b"
|
7 |
+
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
9 |
+
|
10 |
+
pipeline = transformers.pipeline(
|
11 |
+
"text-generation",
|
12 |
+
model=model,
|
13 |
+
torch_dtype=torch.float16,
|
14 |
+
device_map="auto",
|
15 |
+
)
|
16 |
+
|
17 |
+
|
18 |
+
sequences = pipeline(
|
19 |
+
'The TinyLlama project aims to pretrain a 1.1B Llama model on 3 trillion tokens. With some proper optimization, we can achieve this within a span of "just" 90 days using 16 A100-40G GPUs ππ. The training has started on 2023-09-01.Chat Using TinyLlama',
|
20 |
+
do_sample=True,
|
21 |
+
top_k=10,
|
22 |
+
num_return_sequences=1,
|
23 |
+
repetition_penalty=1.5,
|
24 |
+
eos_token_id=tokenizer.eos_token_id,
|
25 |
+
max_length=500,
|
26 |
+
)
|
27 |
+
|
28 |
+
for seq in sequences:
|
29 |
+
print(f"Result :{seq['generated_text']}")
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|