Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix json.decoder.JSONDecodeError when load pipeline_schema.json #859

Merged
merged 1 commit into from
May 24, 2024

Conversation

AlphaHinex
Copy link
Contributor

When we use modelscope server to serve the model, the comma after last json object in this file will cause the error bellow:

ERROR:    Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 732, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 608, in __aenter__
    await self._router.startup()
  File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 711, in startup
    handler()
  File "/opt/conda/lib/python3.10/site-packages/modelscope/server/core/event_handlers.py", line 37, in startup
    _startup_model(app)
  File "/opt/conda/lib/python3.10/site-packages/modelscope/server/core/event_handlers.py", line 22, in _startup_model
    info['schema'] = get_task_schemas(app.state.pipeline.group_key)
  File "/opt/conda/lib/python3.10/site-packages/modelscope/utils/input_output.py", line 837, in get_task_schemas
    schema = json.load(f)
  File "/opt/conda/lib/python3.10/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/opt/conda/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/opt/conda/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/opt/conda/lib/python3.10/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 3836 column 1 (char 100720)

When we use `modelscope server` to serve the model, the comma after last json object in this file will cause the error bellow:

```log
ERROR:    Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 732, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 608, in __aenter__
    await self._router.startup()
  File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 711, in startup
    handler()
  File "/opt/conda/lib/python3.10/site-packages/modelscope/server/core/event_handlers.py", line 37, in startup
    _startup_model(app)
  File "/opt/conda/lib/python3.10/site-packages/modelscope/server/core/event_handlers.py", line 22, in _startup_model
    info['schema'] = get_task_schemas(app.state.pipeline.group_key)
  File "/opt/conda/lib/python3.10/site-packages/modelscope/utils/input_output.py", line 837, in get_task_schemas
    schema = json.load(f)
  File "/opt/conda/lib/python3.10/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/opt/conda/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/opt/conda/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/opt/conda/lib/python3.10/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 3836 column 1 (char 100720)
```
@wenmengzhou wenmengzhou merged commit da985ad into modelscope:master May 24, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants