Skip to content

add: upload new research files#3

Open
mayuxi987 wants to merge 1 commit into
modelscope:mainfrom
mayuxi987:upload-new-files
Open

add: upload new research files#3
mayuxi987 wants to merge 1 commit into
modelscope:mainfrom
mayuxi987:upload-new-files

Conversation

@mayuxi987

Copy link
Copy Markdown

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive set of demo and tutorial materials for a Claude Code engineering lecture, including a mock training script, configuration files (CLAUDE.md, settings.json), custom skills, presentation slides, and speaker notes. The review feedback highlights several robust improvements for the Python script and configuration: initializing the loss variable in train.py to avoid a potential NameError when epochs is non-positive, separating imports to adhere to PEP 8, explicitly defining the UTF-8 encoding when writing JSON files, and quoting the $CLAUDE_TOOL_INPUT shell variable in settings.json to prevent shell-splitting bugs.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +9 to +10
best_acc = 0.0
for ep in range(1, epochs + 1):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If epochs is set to 0 or a negative value, the training loop will not execute, and the variable loss will never be defined. This will result in a NameError when attempting to round and log loss after the loop. Initializing loss beforehand prevents this potential runtime crash.

Suggested change
best_acc = 0.0
for ep in range(1, epochs + 1):
best_acc = 0.0
loss = 0.0
for ep in range(1, epochs + 1):

@@ -0,0 +1,35 @@
import json, time, random, argparse

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to PEP 8, imports should be on separate lines rather than grouped on a single line. This improves readability and makes tracking changes easier.

import argparse
import json
import random
import time
References
  1. PEP 8: Imports should usually be on separate lines. (link)


out = Path("results") / f"run_{seed:03d}.json"
out.parent.mkdir(exist_ok=True)
out.write_text(json.dumps(results, indent=2))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When writing text files, it is highly recommended to specify an explicit encoding (such as 'utf-8') rather than relying on the platform's default encoding. This prevents potential encoding issues on different operating systems (e.g., Windows).

Suggested change
out.write_text(json.dumps(results, indent=2))
out.write_text(json.dumps(results, indent=2), encoding="utf-8")

"afterToolUse": [
{
"matcher": "Edit|Write",
"command": "echo '[hook] File modified: checking Python syntax...' && python3 -m py_compile \"$(echo $CLAUDE_TOOL_INPUT | python3 -c \"import sys,json; d=json.load(sys.stdin); print(d.get('file_path',''))\" 2>/dev/null || echo '')\" 2>&1 | head -5 || true"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The shell variable $CLAUDE_TOOL_INPUT is unquoted inside the subshell. If the JSON input contains spaces, wildcards, or other shell-active characters, the shell will perform word splitting and globbing, which can lead to syntax errors or unexpected behavior. Wrapping it in double quotes ensures robust execution.

Suggested change
"command": "echo '[hook] File modified: checking Python syntax...' && python3 -m py_compile \"$(echo $CLAUDE_TOOL_INPUT | python3 -c \"import sys,json; d=json.load(sys.stdin); print(d.get('file_path',''))\" 2>/dev/null || echo '')\" 2>&1 | head -5 || true"
"command": "echo '[hook] File modified: checking Python syntax...' && python3 -m py_compile \"$(echo \\\"$CLAUDE_TOOL_INPUT\\\" | python3 -c \"import sys,json; d=json.load(sys.stdin); print(d.get('file_path',''))\" 2>/dev/null || echo '')\" 2>&1 | head -5 || true"

@VoyagerXvoyagerx

Copy link
Copy Markdown
Collaborator

Hi @mayuxi987, thanks for sharing your Claude Code tutorial content!
However, the current file structure and submission format don't align with this repo's conventions. A few points:

  1. Directory structure — This repo is an awesome-list organized by research stages. New entries should be added as a row in the corresponding table in README.md, rather than uploading raw files to assets/.

  2. Files that shouldn't be in git — Multiple .DS_Store files, a zip archive, and the original PPT are not suitable for version control.

  3. Recommended path — Please consider turning the tutorial into a reusable best-practice write-up (e.g., publish on ModelScope Learn with the #vibe-research tag), then open a new PR that only adds one row to the relevant stage table in README.md with a link to your article. See the "🤝 How to Contribute" section at the bottom of the README for details.

Feel free to close this PR and resubmit following the guide above. Happy to help if you have any questions!

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.

2 participants