This repository was archived by the owner on Jan 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +1
-3
lines changed
gpt2/src/main/java/co/huggingface/android_transformers/gpt2/ml Expand file tree Collapse file tree 1 file changed +1
-3
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import android.app.Application
44import android.text.Spannable
55import android.text.SpannableStringBuilder
66import android.util.JsonReader
7- import android.util.Log
87import android.widget.TextView
98import androidx.core.content.res.ResourcesCompat
109import androidx.databinding.BindingAdapter
@@ -18,7 +17,6 @@ import java.io.FileInputStream
1817import java.io.InputStreamReader
1918import java.nio.channels.FileChannel
2019import kotlin.math.exp
21- import kotlin.math.min
2220import kotlin.random.Random
2321
2422private const val SEQUENCE_LENGTH = 64
@@ -87,7 +85,7 @@ class GPT2Client(application: Application) : AndroidViewModel(application) {
8785 launchAutocomplete()
8886 }
8987
90- private suspend fun generate (text : String , nbTokens : Int = 50 ) = withContext(Dispatchers .Default ) {
88+ private suspend fun generate (text : String , nbTokens : Int = 100 ) = withContext(Dispatchers .Default ) {
9189 val tokens = tokenizer.encode(text)
9290 repeat (nbTokens) {
9391 val maxTokens = tokens.takeLast(SEQUENCE_LENGTH ).toIntArray()
You can’t perform that action at this time.
0 commit comments