Title: Python restriction not working properly · Issue #212 · structuredllm/syncode · GitHub
Open Graph Title: Python restriction not working properly · Issue #212 · structuredllm/syncode
X Title: Python restriction not working properly · Issue #212 · structuredllm/syncode
Description: I have an issue using the default python grammer. When i try to run: import sys sys.path.append('..') # Assuming we are in the root directory from syncode import Syncode import warnings warnings.filterwarnings('ignore') model_name = "mic...
Open Graph Description: I have an issue using the default python grammer. When i try to run: import sys sys.path.append('..') # Assuming we are in the root directory from syncode import Syncode import warnings warnings.fi...
X Description: I have an issue using the default python grammer. When i try to run: import sys sys.path.append('..') # Assuming we are in the root directory from syncode import Syncode import warnings war...
Opengraph URL: https://github.com/structuredllm/syncode/issues/212
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Python restriction not working properly","articleBody":"I have an issue using the default python grammer.\nWhen i try to run:\n ```python\nimport sys\nsys.path.append('..') # Assuming we are in the root directory\nfrom syncode import Syncode\nimport warnings\nwarnings.filterwarnings('ignore')\n\nmodel_name = \"microsoft/phi-2\"\n\n# Load the unconstrained original model\nllm = Syncode(model = model_name, mode='original', max_new_tokens=200)\n\n# Load the Syncode augmented model\nsyn_llm = Syncode(\n model = model_name, \n mode='grammar_mask', \n grammar='python', \n parse_output_only=True,\n opp=False\n )\n\npartial_code = \"No Markdown no explanation no comments in code. Write helloworld python code.\"\noutput = syn_llm.infer(partial_code)[0]\nprint(output)\n```\nI get the following output as code:\n````python\n# Solution\ndef hello_world():\n print(\"Hello, World!\")\n\nhello_world()\n```\n\n2. Write a Python program to create a list of numbers from 1 to 10 and print the list.\n\n```python\n# Solution\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nprint(numbers)\n```\n\n3. Write a Python program to create a dictionary of fruits and their prices and print the dictionary.\n\n```python\n# Solution\nfruits = {\n \"apple\": 1.5,\n \"banana\": 0.5,\n \"orange\": 1.0\n...\n\n```python\n# Solution\n````\nUnfortunatly the markdown characters as well as the tasks hallucinated by the model are not getting suppressed by the grammar-tool\nresulting in invalid python code. Did I misuse the tool or is this a bug?\nMight be related to the issue #211.","author":{"url":"https://github.com/justheretostealcode","@type":"Person","name":"justheretostealcode"},"datePublished":"2025-06-23T10:39:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/212/syncode/issues/212"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:86649634-0e4f-719e-2ee4-22e4560644c6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 94BA:18F5B7:6F7C45:8EC72B:6990AAA7 |
| html-safe-nonce | 508c8f8adad793c26719874073bf422abf6b670bfc8a5487204da652f604c55b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NEJBOjE4RjVCNzo2RjdDNDU6OEVDNzJCOjY5OTBBQUE3IiwidmlzaXRvcl9pZCI6IjQwODM5OTI5MTY0MzkxMTY0NTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 672c9ae5bbb83e5693447eaac673342b74b944ce004ba7a2020e79d04cba4358 |
| hovercard-subject-tag | issue:3167684922 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/structuredllm/syncode/212/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b481e16b13615b811b62869594be43077868c41b378bc3981ca836546889cd5e/structuredllm/syncode/issues/212 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b481e16b13615b811b62869594be43077868c41b378bc3981ca836546889cd5e/structuredllm/syncode/issues/212 |
| og:image:alt | I have an issue using the default python grammer. When i try to run: import sys sys.path.append('..') # Assuming we are in the root directory from syncode import Syncode import warnings warnings.fi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | justheretostealcode |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/structuredllm/syncode git https://github.com/structuredllm/syncode.git |
| octolytics-dimension-user_id | 204232273 |
| octolytics-dimension-user_login | structuredllm |
| octolytics-dimension-repository_id | 687211074 |
| octolytics-dimension-repository_nwo | structuredllm/syncode |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 687211074 |
| octolytics-dimension-repository_network_root_nwo | structuredllm/syncode |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3b33c5aedc9808f45bc5fcf0b1e4404cf749dac7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width