jskinner215 commited on
Commit
5539883
·
1 Parent(s): b1fc865

Errors on chunking and cordinates

Browse files

Token shape: 512: This means the model should be able to handle this without exceeding the token limit, which is good.

Type of coordinates[0]: <class 'tuple'>: This shows that the coordinates are tuples, which means we have to use them as indices in a different way.

Value of coordinates[0]: (0, 8): This likely indicates the row and column indices, respectively.

An error occurred: 'str' object has no attribute 'values': This means that chunk.iloc[coordinates[0]].values is a string and doesn't have the attribute "values." We need to fix this line.

An error occurred: iloc cannot enlarge its target object: This could indicate an indexing error and needs further investigation.

Let's start by addressing these issues.

The coordinates being a tuple suggest that they should be used as (row, column) indices directly.
The 'str' object has no attribute 'values' error suggests that we might need to remove .values from chunk.iloc[coordinates[0]].values.

Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -30,13 +30,16 @@ def ask_llm_chunk(chunk, questions):
30
  for coordinates in predicted_answer_coordinates:
31
  st.write(f"Type of coordinates[0]: {type(coordinates[0])}") # Debugging line
32
  st.write(f"Value of coordinates[0]: {coordinates[0]}") # Debugging line
 
33
  if len(coordinates) == 1:
34
- answers.append(chunk.iloc[coordinates[0]].values)
 
35
  else:
36
  cell_values = []
37
  for coordinate in coordinates:
38
- cell_values.append(chunk.iloc[coordinate].values)
39
- answers.append(", ".join(cell_values))
 
40
  return answers
41
  except Exception as e:
42
  st.write(f"An error occurred: {e}")
@@ -44,6 +47,7 @@ def ask_llm_chunk(chunk, questions):
44
 
45
 
46
 
 
47
  MAX_ROWS_PER_CHUNK = 200
48
 
49
  def summarize_map_reduce(data, questions):
 
30
  for coordinates in predicted_answer_coordinates:
31
  st.write(f"Type of coordinates[0]: {type(coordinates[0])}") # Debugging line
32
  st.write(f"Value of coordinates[0]: {coordinates[0]}") # Debugging line
33
+
34
  if len(coordinates) == 1:
35
+ row, col = coordinates[0]
36
+ answers.append(chunk.iloc[row, col])
37
  else:
38
  cell_values = []
39
  for coordinate in coordinates:
40
+ row, col = coordinate
41
+ cell_values.append(chunk.iloc[row, col])
42
+ answers.append(", ".join(map(str, cell_values)))
43
  return answers
44
  except Exception as e:
45
  st.write(f"An error occurred: {e}")
 
47
 
48
 
49
 
50
+
51
  MAX_ROWS_PER_CHUNK = 200
52
 
53
  def summarize_map_reduce(data, questions):