Skip to content

Commit 1409dd6

Browse files
committed
fixups
1 parent 806589a commit 1409dd6

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

backend/python/petals/backend_petals.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ def Predict(self, request, context):
7575
inputs = self.tokenizer(request.Prompt, return_tensors="pt")["input_ids"]
7676
if self.cuda:
7777
inputs = inputs.cuda()
78+
79+
if request.Tokens == 0:
80+
# Max to max value if tokens are not specified
81+
request.Tokens = 8192
82+
83+
# TODO: kwargs and map all parameters
7884
outputs = self.model.generate(inputs, max_new_tokens=request.Tokens)
7985

8086
generated_text = self.tokenizer.decode(outputs[0])

backend/python/petals/run.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
export PATH=$PATH:/opt/conda/bin
77

88
# Activate conda environment
9-
source activate petals
9+
# if source is available use it, or use conda
10+
#
11+
if [ -f /opt/conda/bin/activate ]; then
12+
source activate petals
13+
else
14+
eval "$(conda shell.bash hook)"
15+
conda activate petals
16+
fi
1017

1118
# get the directory where the bash script is located
1219
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

examples/configurations/petals.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)