Skip to content

socketteer/transformer-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

transformer-tests

Code unkempt. Experiments in progress.

OpenAI docs


parameters

engine_id string Required

The ID of the engine to use for this request (davinci, curie, babbage, ada, curie-instruct-beta, davinci-instruct-beta)


prompt string or array

The prompt(s) to generate completions for, encoded as a string, a list of strings, or a list of token lists.


max_tokens integer, defaults to 16

The maximum number of tokens to generate. Requests can use up to 2048 tokens shared between prompt and completion.


temperature number, defaults to 1


top_p number, defaults to 1

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.


n integer, defaults to 1

How many completions to generate for each prompt.


stream boolean, defaults to False

Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.


logprobs integer, defaults to null

Include the log probabilities on the logprobs most likely tokens, as well the chosen tokens. For example, if logprobs is 10, the API will return a list of the 10 most likely tokens. the API will always return the logprob of the sampled token, so there may be up to logprobs+1 elements in the response.


echo boolean, defaults to False

Echo back the prompt (and prompt logprobs) in addition to the completion


stop string or array, defaults to null

Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.


presence_penalty number, defaults to 0

Number between 0 and 1 that penalizes new tokens based on whether they appear in the text so far.


frequency_penalty number, defaults to 0

Number between 0 and 1 that penalizes new tokens based on their existing frequency in the text so far.


best_of integer, defaults to 1

Generates best_of completions server-side and returns the "best" (the one with the lowest log probability per token). Results cannot be streamed.

When used with n, best_of controls the number of candidate completions and n specifies how many to return – best_of must be greater than n.


logit_bias map, defaults to null

Modify the likelihood of specified tokens appearing in the completion.

Accepts a json object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. Use GPT2Tokenizer to convert text to token IDs.

Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.

As an example, you can pass {"50256": -100} to prevent the <|endoftext|> token from being generated.


usage tips

  • Don't end prompts with a space character. This will cause unwanted behavior because tokenization groups spaces at the front of words. It is fine to end a prompt with newlines, tabs, etc.

About

Messy scripts exploring GPT-3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published