{
  "id": 431553,
  "title": "Edit, Scoring issue resolved!",
  "url": "/competitions/asl-fingerspelling/discussion/431553",
  "author_name": "Andy Atkinson",
  "post_date": "2023-08-14T04:26:46.360000",
  "votes": 0,
  "comment_count": 0,
  "views": 0,
  "content": "<p></p>\n<p></p>\n<p></p>\n<p></p>\n<p><strong>EDIT2:</strong> This runtime error was resolved in my testing; Scoring has now passed 7 mins, 12 mins and counting.</p>\n<p><strong>EDIT3:</strong> Scoring completed successfully!</p>\n<p><strong>the fix</strong>:  The issue was that I was looping through phrase length of predictions with a transformer seq 2 seq and I only allowed phrase length spots in my TensorArray, without remembering my start of sentence, SOS, token will take up one of them.  For maximum length predictions this would break my tflite model. I added 2 additional spots to the size, though 1 might have been sufficient:</p>\n<pre><code>   this:  preds = tf.\n   not this:  preds = tf.\n</code></pre>\n<p><strong>The things that I've done so far to stop the Scoring fail:</strong></p>\n<ol>\n<li>putting this at the beginning of my preprocessing to remove blank inputs  <strong>(necessary to complete Scoring)</strong><br>\n      x = tf.where(tf.math.is_nan(x), tf.zeros_like(x), x)<br>\n      x= x[None]</li>\n<li>making sure that I'm returning a float data type and not an integer.  <strong>(necessary to complete Scoring)</strong></li>\n<li>Stopped using tf.lite.OpsSet.SELECT_TF_OPS or any other additional supported ops when converting the tflite model, use only tflite runtime. <strong>(necessary to complete Scoring)</strong></li>\n<li>making sure i'm using the right file names within my zip file.  <strong>(necessary to complete Scoring)</strong></li>\n<li>corrected the elements overflow issue detailed above.  <strong>(necessary to complete Scoring)</strong></li>\n<li>making sure I'm returning the shape of (x, 59). So removing the pad, sos, and eos tokens before returning. (not sure if i needed)</li>\n<li>ensured I'm returning at least one token, so (1,59) or more. (not sure if i needed)</li>\n</ol>",
  "messages": [
    {
      "id": 2389455,
      "postDate": "2023-08-14T04:26:46.360Z",
      "content": "<p></p>\n<p></p>\n<p></p>\n<p></p>\n<p><strong>EDIT2:</strong> This runtime error was resolved in my testing; Scoring has now passed 7 mins, 12 mins and counting.</p>\n<p><strong>EDIT3:</strong> Scoring completed successfully!</p>\n<p><strong>the fix</strong>:  The issue was that I was looping through phrase length of predictions with a transformer seq 2 seq and I only allowed phrase length spots in my TensorArray, without remembering my start of sentence, SOS, token will take up one of them.  For maximum length predictions this would break my tflite model. I added 2 additional spots to the size, though 1 might have been sufficient:</p>\n<pre><code>   this:  preds = tf.\n   not this:  preds = tf.\n</code></pre>\n<p><strong>The things that I've done so far to stop the Scoring fail:</strong></p>\n<ol>\n<li>putting this at the beginning of my preprocessing to remove blank inputs  <strong>(necessary to complete Scoring)</strong><br>\n      x = tf.where(tf.math.is_nan(x), tf.zeros_like(x), x)<br>\n      x= x[None]</li>\n<li>making sure that I'm returning a float data type and not an integer.  <strong>(necessary to complete Scoring)</strong></li>\n<li>Stopped using tf.lite.OpsSet.SELECT_TF_OPS or any other additional supported ops when converting the tflite model, use only tflite runtime. <strong>(necessary to complete Scoring)</strong></li>\n<li>making sure i'm using the right file names within my zip file.  <strong>(necessary to complete Scoring)</strong></li>\n<li>corrected the elements overflow issue detailed above.  <strong>(necessary to complete Scoring)</strong></li>\n<li>making sure I'm returning the shape of (x, 59). So removing the pad, sos, and eos tokens before returning. (not sure if i needed)</li>\n<li>ensured I'm returning at least one token, so (1,59) or more. (not sure if i needed)</li>\n</ol>",
      "rawMarkdown": "~~My model fails scoring at 7 mins, any advice?~~\n\n~~**EDIT: **In testing my model in the notebook for long enough I got this error on phrase index 384:~~\n\n   ~~**RuntimeError: /tensorflow/tensorflow/lite/util.cc BytesRequired number of elements overflowed.**~~\n\n~~Any ideas???~~\n\n**EDIT2:** This runtime error was resolved in my testing; Scoring has now passed 7 mins, 12 mins and counting.\n\n**EDIT3:** Scoring completed successfully!\n\n**the fix**:  The issue was that I was looping through phrase length of predictions with a transformer seq 2 seq and I only allowed phrase length spots in my TensorArray, without remembering my start of sentence, SOS, token will take up one of them.  For maximum length predictions this would break my tflite model. I added 2 additional spots to the size, though 1 might have been sufficient:\n\n       this:  preds = tf.TensorArray(tf.int32, size=MAX_PHRASE_LENGTH+2)\n       not this:  preds = tf.TensorArray(tf.int32, size=MAX_PHRASE_LENGTH)\n\n\n**The things that I've done so far to stop the Scoring fail:**\n\n1. putting this at the beginning of my preprocessing to remove blank inputs  **(necessary to complete Scoring)**\n          x = tf.where(tf.math.is_nan(x), tf.zeros_like(x), x)\n          x= x[None]\n2. making sure that I'm returning a float data type and not an integer.  **(necessary to complete Scoring)**\n3. Stopped using tf.lite.OpsSet.SELECT_TF_OPS or any other additional supported ops when converting the tflite model, use only tflite runtime. **(necessary to complete Scoring)**\n4. making sure i'm using the right file names within my zip file.  **(necessary to complete Scoring)**\n5. corrected the elements overflow issue detailed above.  **(necessary to complete Scoring)**\n5. making sure I'm returning the shape of (x, 59). So removing the pad, sos, and eos tokens before returning. (not sure if i needed)\n6. ensured I'm returning at least one token, so (1,59) or more. (not sure if i needed)\n"
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "2389455": "~~My model fails scoring at 7 mins, any advice?~~\n\n~~**EDIT: **In testing my model in the notebook for long enough I got this error on phrase index 384:~~\n\n   ~~**RuntimeError: /tensorflow/tensorflow/lite/util.cc BytesRequired number of elements overflowed.**~~\n\n~~Any ideas???~~\n\n**EDIT2:** This runtime error was resolved in my testing; Scoring has now passed 7 mins, 12 mins and counting.\n\n**EDIT3:** Scoring completed successfully!\n\n**the fix**:  The issue was that I was looping through phrase length of predictions with a transformer seq 2 seq and I only allowed phrase length spots in my TensorArray, without remembering my start of sentence, SOS, token will take up one of them.  For maximum length predictions this would break my tflite model. I added 2 additional spots to the size, though 1 might have been sufficient:\n\n       this:  preds = tf.TensorArray(tf.int32, size=MAX_PHRASE_LENGTH+2)\n       not this:  preds = tf.TensorArray(tf.int32, size=MAX_PHRASE_LENGTH)\n\n\n**The things that I've done so far to stop the Scoring fail:**\n\n1. putting this at the beginning of my preprocessing to remove blank inputs  **(necessary to complete Scoring)**\n          x = tf.where(tf.math.is_nan(x), tf.zeros_like(x), x)\n          x= x[None]\n2. making sure that I'm returning a float data type and not an integer.  **(necessary to complete Scoring)**\n3. Stopped using tf.lite.OpsSet.SELECT_TF_OPS or any other additional supported ops when converting the tflite model, use only tflite runtime. **(necessary to complete Scoring)**\n4. making sure i'm using the right file names within my zip file.  **(necessary to complete Scoring)**\n5. corrected the elements overflow issue detailed above.  **(necessary to complete Scoring)**\n5. making sure I'm returning the shape of (x, 59). So removing the pad, sos, and eos tokens before returning. (not sure if i needed)\n6. ensured I'm returning at least one token, so (1,59) or more. (not sure if i needed)\n"
  }
}