Error in Graded Lab1, exercise 2

Cannot make exercise 2 work because result = constrained_gen(formatted) returns str instead of JSON object so it raises exception:

'str' object has no attribute 'issue_type'

As outlines documentation says, Outlines generation functions output plain strings by design, even when you restrict the model to a JSON schema. The library guarantees that the generated string adheres precisely to your constraints, but you must manually parse the returned text into a Python dictionary or object.

It’s impossible to edit ungraded cells. I tried to do an workaround with a custom constrained_gen function that parses the output to JSON before return it, but the string object I get before parsing is truncated (I don’t receive the full json string), and it raises:

 Invalid JSON: EOF while parsing a string at line 1 column

hi @Guillermo_Acosta

Are you encountering error? for exercise 2

Hi. I encounter that in table every result fails:

Strategy 2: Constrained Decoding — Results

# Issue Status Type Severity Time
0 add dream dataset :cross_mark: fail -– -– 0.0s
1 concatenate_datasets loads all the data into :cross_mark: fail -– -– 0.0s
2 load_metric from local “glue.py” meet error ’ :cross_mark: fail -– -– 0.0s
3 Implement Dataset to JSON :cross_mark: fail -– -– 0.0s
4 How to choose proper download_mode in functio :cross_mark: fail -– -– 0.0s

I digged into it and I found it’s because of the exception I mentioned 'str' object has no attribute 'issue_type'. The code silently fails

@Guillermo_Acosta

this issue is already reported.

please wait for staff response to update, there needs to be changed in codes in the subsequent cell for the results to be json.

As Tom has notified the staff already again, but probably due to weekend, there might be delay in the update, so please wait until staff response on your thread.