Skip to content

Commit b34ff96

Browse files
author
Julien Salinas
committed
Remove some deprecated text generation parameters.
1 parent affe199 commit b34ff96

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,21 +228,16 @@ The above command returns a JSON object.
228228
Call the `generation()` method and pass the following arguments:
229229

230230
1. The block of text that starts the generated text. 256 tokens maximum for GPT-J on CPU, 1024 tokens maximum for GPT-J and GPT-NeoX 20B on GPU, and 2048 tokens maximum for Fast GPT-J and Finetuned GPT-NeoX 20B on GPU.
231-
1. (Optional) `min_length`: The minimum number of tokens that the generated text should contain. 256 tokens maximum for GPT-J on CPU, 1024 tokens maximum for GPT-J and GPT-NeoX 20B on GPU, and 2048 tokens maximum for Fast GPT-J and Finetuned GPT-NeoX 20B on GPU.. If `length_no_input` is false, the size of the generated text is the difference between `min_length` and the length of your input text. If `length_no_input` is true, the size of the generated text simply is `min_length`. Defaults to 10.
232231
1. (Optional) `max_length`: Optional. The maximum number of tokens that the generated text should contain. 256 tokens maximum for GPT-J on CPU, 1024 tokens maximum for GPT-J and GPT-NeoX 20B on GPU, and 2048 tokens maximum for Fast GPT-J and Finetuned GPT-NeoX 20B on GPU. If `length_no_input` is false, the size of the generated text is the difference between `max_length` and the length of your input text. If `length_no_input` is true, the size of the generated text simply is `max_length`. Defaults to 50.
233232
1. (Optional) `length_no_input`: Whether `min_length` and `max_length` should not include the length of the input text, as a boolean. If false, `min_length` and `max_length` include the length of the input text. If true, min_length and `max_length` don't include the length of the input text. Defaults to false.
234233
1. (Optional) `end_sequence`: A specific token that should be the end of the generated sequence, as a string. For example if could be `.` or `\n` or `###` or anything else below 10 characters.
235234
1. (Optional) `remove_input`: Whether you want to remove the input text form the result, as a boolean. Defaults to false.
236-
1. (Optional) `do_sample`: Whether or not to use sampling ; use greedy decoding otherwise, as a boolean. Defaults to true.
237235
1. (Optional) `num_beams`: Number of beams for beam search. 1 means no beam search. This is an integer. Defaults to 1.
238-
1. (Optional) `early_stopping`: Whether to stop the beam search when at least num_beams sentences are finished per batch or not, as a boolean. Defaults to false.
239-
1. (Optional) `no_repeat_ngram_size`: If set to int > 0, all ngrams of that size can only occur once. This is an integer. Defaults to 0.
240236
1. (Optional) `num_return_sequences`: The number of independently computed returned sequences for each element in the batch, as an integer. Defaults to 1.
241237
1. (Optional) `top_k`: The number of highest probability vocabulary tokens to keep for top-k-filtering, as an integer. Maximum 1000 tokens. Defaults to 0.
242238
1. (Optional) `top_p`: If set to float < 1, only the most probable tokens with probabilities that add up to top_p or higher are kept for generation. This is a float. Should be between 0 and 1. Defaults to 0.7.
243239
1. (Optional) `temperature`: The value used to module the next token probabilities, as a float. Should be between 0 and 1. Defaults to 1.
244240
1. (Optional) `repetition_penalty`: The parameter for repetition penalty, as a float. 1.0 means no penalty. Defaults to 1.0.
245-
1. (Optional) `length_penalty`: Exponential penalty to the length, as a float. 1.0 means no penalty. Set to values < 1.0 in order to encourage the model to generate shorter sequences, or to a value > 1.0 in order to encourage the model to produce longer sequences. Defaults to 1.0.
246241
1. (Optional) `bad_words`: List of tokens that are not allowed to be generated, as a list of strings. Defaults to null.
247242
1. (Optional) `remove_end_sequence`: Optional. Whether you want to remove the `end_sequence` string from the result. Defaults to false.
248243

nlpcloud/__init__.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -188,31 +188,25 @@ def entities(self, text, searched_entity=None):
188188

189189
return r.json()
190190

191-
def generation(self, text, min_length=None, max_length=None, length_no_input=None,
192-
end_sequence=None, remove_input=None, do_sample=None, num_beams=None, early_stopping=None,
193-
no_repeat_ngram_size=None, num_return_sequences=None, top_k=None, top_p=None,
194-
temperature=None, repetition_penalty=None, length_penalty=None, bad_words=None, remove_end_sequence=None,
195-
is_instruct=None):
191+
def generation(self, text, max_length=None, length_no_input=None,
192+
end_sequence=None, remove_input=None, num_beams=None,
193+
num_return_sequences=None, top_k=None, top_p=None,
194+
temperature=None, repetition_penalty=None, bad_words=None,
195+
remove_end_sequence=None):
196196
payload = {
197197
"text": text,
198-
"min_length": min_length,
199198
"max_length": max_length,
200199
"length_no_input": length_no_input,
201200
"end_sequence": end_sequence,
202201
"remove_input": remove_input,
203-
"do_sample": do_sample,
204202
"num_beams": num_beams,
205-
"early_stopping": early_stopping,
206-
"no_repeat_ngram_size": no_repeat_ngram_size,
207203
"num_return_sequences": num_return_sequences,
208204
"top_k": top_k,
209205
"top_p": top_p,
210206
"temperature": temperature,
211207
"repetition_penalty": repetition_penalty,
212-
"length_penalty": length_penalty,
213208
"bad_words": bad_words,
214209
"remove_end_sequence": remove_end_sequence,
215-
"is_instruct": is_instruct,
216210
}
217211

218212
r = requests.post(

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='nlpcloud',
5-
version='1.1.43',
5+
version='1.1.44',
66
description='Python client for the NLP Cloud API',
77
long_description="NLP Cloud serves high performance pre-trained or custom models for NER, sentiment-analysis, classification, summarization, paraphrasing, grammar and spelling correction, keywords and keyphrases extraction, chatbot, product description and ad generation, intent classification, text generation, image generation, code generation, question answering, automatic speech recognition, machine translation, language detection, semantic search, semantic similarity, speech synthesis, tokenization, POS tagging, embeddings, and dependency parsing. It is ready for production, served through a REST API.\n\nThis is the Python client for the API.\n\nMore details here: https://nlpcloud.io\n\nDocumentation: https://docs.nlpcloud.io\n\nGithub: https://github.com/nlpcloud/nlpcloud-python",
88
packages=['nlpcloud'],

0 commit comments

Comments
 (0)