The code does not work...

#1
by zhiminy - opened

image.png

JSONDecodeError Traceback (most recent call last)
/Users/jimmy/Documents/GitHub/LLM-Leaderboard-Integration/code/main.ipynb Cell 4 line 2
1 client = Client("https://felixz-open-llm-leaderboard.hf.space/")
----> 2 json_data = client.predict("","", api_name='/predict')
4 with open(json_data, 'r') as file:
5 file_data = file.read()

File ~/Documents/GitHub/LLM-Leaderboard-Integration/.venv/lib/python3.11/site-packages/gradio_client/client.py:305, in Client.predict(self, api_name, fn_index, *args)
301 if self.endpoints[inferred_fn_index].is_continuous:
302 raise ValueError(
303 "Cannot call predict on this function as it may run forever. Use submit instead."
304 )
--> 305 return self.submit(*args, api_name=api_name, fn_index=fn_index).result()

File ~/Documents/GitHub/LLM-Leaderboard-Integration/.venv/lib/python3.11/site-packages/gradio_client/client.py:1456, in Job.result(self, timeout)
1441 def result(self, timeout: float | None = None) -> Any:
1442 """
1443 Return the result of the call that the future represents. Raises CancelledError: If the future was cancelled, TimeoutError: If the future didn't finish executing before the given timeout, and Exception: If the call raised then that exception will be raised.
1444
(...)
1454 >> 9
1455 """
-> 1456 return super().result(timeout=timeout)
...
--> 353 obj, end = self.scan_once(s, idx)
354 except StopIteration as err:
355 raise JSONDecodeError("Expecting value", s, err.value) from None

JSONDecodeError: Unterminated string starting at: line 1 column 16256 (char 16255)

@zhiminy Hi
Yea I know I have been struggling to figure out what happened.
See what I do is clone the space from the main Leaderboard and take out the UI part and just dump the result of the evaluations into API interface.
Last week they upgraded the gradio framework from 4.3... to 4.8 but this is a major upgrade. Somehow the same code that used to work fine is now outputting invalid json data.
The gradio client also wad updated to 0.7.1. I am testing with latest versions of these and I get same thing. I am trying to figure it out as I want to generate my reports as well.

@zhiminy It is back i working order. Sorry for the inconvenience. Somehow the newest versions of Gradio seem to work again.

@zhiminy It is back i working order. Sorry for the inconvenience. Somehow the newest versions of Gradio seem to work again.

Thanks for replying. I tried it again but still had the error below:
```
Loaded as API: https://felixz-open-llm-leaderboard.hf.space/ βœ”

TypeError Traceback (most recent call last)
Cell In[75], line 7
3 client = Client("https://felixz-open-llm-leaderboard.hf.space/")
5 json_data = client.predict("","", api_name='/predict')
----> 7 with open(json_data, 'r') as file:
8 file_data = file.read()
10 # Load the JSON data

File ~/Documents/GitHub/LLM-Leaderboard-Integration/.venv/lib/python3.11/site-packages/IPython/core/interactiveshell.py:301, in _modified_open(file, *args, **kwargs)
299 @functools.wraps(io_open)
300 def _modified_open(file, *args, **kwargs):
--> 301 if file in {0, 1, 2}:
302 raise ValueError(
303 f"IPython won't let you open fd={file} by default "
304 "as it is likely to crash IPython. If you know what you are doing, "
305 "you can use builtins' open."
306 )
308 return io_open(file, *args, **kwargs)

TypeError: unhashable type: 'dict'
```

Sign up or log in to comment