Spaces:
Runtime error
Runtime error
Commit
·
e3e6a48
1
Parent(s):
e71a2ba
another test
Browse files
app.py
CHANGED
|
@@ -8,16 +8,17 @@ import gradio as gr
|
|
| 8 |
from src.client.remote_model import DistributedBloomForCausalLM
|
| 9 |
|
| 10 |
|
| 11 |
-
MODEL_NAME = "bigscience/test-bloomd-6b3" # select model you like
|
| 12 |
-
INITIAL_PEERS = ["/ip4/193.106.95.184/tcp/31000/p2p/QmSg7izCDtowVTACbUmWvEiQZNY4wgCQ9T9Doo66K59X6q"]
|
| 13 |
|
| 14 |
-
tokenizer = transformers.BloomTokenizerFast.from_pretrained("bigscience/test-bloomd-6b3")
|
| 15 |
-
model = DistributedBloomForCausalLM.from_pretrained("bigscience/test-bloomd-6b3", initial_peers=INITIAL_PEERS, low_cpu_mem_usage=True, torch_dtype=torch.float32)
|
| 16 |
|
| 17 |
def inference(text, seq_length=1):
|
| 18 |
-
input_ids = tokenizer([text], return_tensors="pt").input_ids
|
| 19 |
-
output = model.generate(input_ids, max_new_tokens=seq_length)
|
| 20 |
-
return tokenizer.batch_decode(output)[0]
|
|
|
|
| 21 |
|
| 22 |
iface = gr.Interface(
|
| 23 |
fn=inference,
|
|
|
|
| 8 |
from src.client.remote_model import DistributedBloomForCausalLM
|
| 9 |
|
| 10 |
|
| 11 |
+
# MODEL_NAME = "bigscience/test-bloomd-6b3" # select model you like
|
| 12 |
+
# INITIAL_PEERS = ["/ip4/193.106.95.184/tcp/31000/p2p/QmSg7izCDtowVTACbUmWvEiQZNY4wgCQ9T9Doo66K59X6q"]
|
| 13 |
|
| 14 |
+
# tokenizer = transformers.BloomTokenizerFast.from_pretrained("bigscience/test-bloomd-6b3")
|
| 15 |
+
# model = DistributedBloomForCausalLM.from_pretrained("bigscience/test-bloomd-6b3", initial_peers=INITIAL_PEERS, low_cpu_mem_usage=True, torch_dtype=torch.float32)
|
| 16 |
|
| 17 |
def inference(text, seq_length=1):
|
| 18 |
+
# input_ids = tokenizer([text], return_tensors="pt").input_ids
|
| 19 |
+
# output = model.generate(input_ids, max_new_tokens=seq_length)
|
| 20 |
+
# return tokenizer.batch_decode(output)[0]
|
| 21 |
+
return text
|
| 22 |
|
| 23 |
iface = gr.Interface(
|
| 24 |
fn=inference,
|