DOTs between sentences

I know this seems silly but could you please help me fix it.

I use the following python codes to receive the response from API:

        completion = openai.Completion.create(prompt=prompt,max_tokens=50,model='xxxx',stop=stop)
        return completion

and

    json_resp = {
        'Idea':prompt+completion.choices[0].text,
        'time': to_datetime("now").isoformat(),
    }

The response I get and print is like this without any dots at the end of sentences:

Start in your spare time and plan on the process taking 3-5 years Set a goal to have a few products in the market that provide enough revenue (royalties) to cover your basic living expenses Then you can quit your day job and dedicate more time and increase the momentum A good idea business should have dozens, if not hundreds of license contracts generating royalties

@tata what does your prompt look like?

@asabet the prompt is like “a good idea for personal business is”

and I send the JSON object and display the result using an HTML form like this:

<html>
<head>
    <title>test</title>
</head>

<body>
    <form id="formElem">
        <input type="text" name="firstname" value="Karam">
        <input type="text" name="lastname" value="Yousef">
        <input type="submit">
    </form>
    <div id="decoded"></div>
    <button id="encode">Encode</button>
    <div id="encoded"></div>
</body>
<script>
    encode.onclick = async (e) => {
        let response = await fetch('http://localhost:8482/encode', {
                method: 'GET',
                headers: {
                    'Content-Type': 'application/json',
                },
        })

        let text = await response.text(); // read response body as text
        data = JSON.parse(text);
        document.querySelector("#encoded").innerHTML = text;
      //  document.querySelector("#encoded").innerHTML = `First name = ${data.firstname} <br/> 
      //                                                  Last name = ${data.lastname} <br/>
      //                                                  Age    = ${data.age}`
    };

    formElem.onsubmit = async (e) => {
      e.preventDefault();
      var form = document.querySelector("#formElem");
     // var form = document.forms[0];

        data = {
          firstname : form.querySelector('input[name="firstname"]').value,
          lastname : form.querySelector('input[name="lastname"]').value,
          age : 5
        }

        let response = await fetch('http://localhost:8482/decode', {
                method: 'POST', // or 'PUT'
                headers: {
                    'Content-Type': 'application/json',
                },
                body: JSON.stringify(data),
        })

        let text = await response.text(); // read response body as text
        document.querySelector("#decoded").innerHTML = text;
    };
</script>
</html>```

@asabet and the model is a fine-tuned model. Could these dot-less sentences be a result of a possible problem with the fine-tuned process? If yes, is it possible for me to add a dot in the results without re-finetuning the model?

@tata thanks for sharing more details. How are sentences punctuated in the completion field of your finetune data? The finetuned model will generally follow the same formatting as your data if you’ve provided enough examples.

Adding . to the end of sentences would require segmenting the text into sentences with a separate model (ie prompted davinci/curie), as heuristics like segmenting on capitalized words may lead to errors. If the cause is a data issue, it would be better to retrain on the fixed data.

1 Like

@asabet thanks for the guidance. In the meantime, I checked the code with the pre-trained general completion model and it returned dots. So the problem is with the fine-tuned model and I should retrain it.

1 Like

Thanks, @m-a.schenk , I retrained the model with the completion field with the dot at the end and the problem was solved.

1 Like