🌐 [translation-sync] Update jax_intro lecture#21
Conversation
|
| Criterion | Score |
|---|---|
| Accuracy | 8/10 |
| Fluency | 9/10 |
| Terminology | 9/10 |
| Formatting | 7/10 |
| Overall | 8.4/10 |
Summary: The translation is generally of high quality with fluent Chinese and accurate technical terminology. However, there are two significant accuracy issues in the changed sections: (1) the DELETED '#### Changing array sizes' section still appears in the translation as '#### 更改数组大小' and must be removed, and (2) the Immutability section and the JIT Compilation speed section contain added content (code examples and explanatory text) not present in the English source. These additions suggest the translation may be based on a different version of the source or contains editorial additions that should be reconciled with the current English source. The 'Why Functional Programming?' section (### 为什么使用函数式编程?) is accurately and fluently translated, preserving the conceptual explanation about computational graphs Technical terminology is consistently handled throughout: JIT编译, 纯函数, 函数式编程, 异步调度, 计算图 are all appropriately translated The random numbers section translation accurately conveys the key concepts of explicit random state management and the comparison between NumPy and JAX approaches The 'Compiling non-pure functions' section (### 编译非纯函数) is well translated with clear explanation of the global variable fusion behavior Mathematical expressions and code blocks are preserved correctly throughout the changed sections
⚠️ Markdown Syntax Errors (CRITICAL)
- 🔴 The translation contains a 'Changing array sizes' section (#### 更改数组大小) that was marked as DELETED in the PR diff but still appears in the translated document. This section should be removed.
Suggestions:
-
速度! section - Translation contains extra content not in source: The translation includes an expanded '#### 使用 NumPy' and '#### 使用 JAX' subsection under JIT Compilation that repeats the cosine example with additional explanatory text ('这里 NumPy 使用预先构建的二进制文件,该文件由精心编写的低级代码编译而成...这个二进制文件随 NumPy 一起发布' and 'JAX 要等到看到数组大小后再进行编译——这需要 JIT 编译方法,而不是提供预编译的二进制文件'). These elaborations are not present in the English source and represent added information.
-
不可变性 (Immutability) section - Translation adds content not in source: The translation includes an in-place sort example with NumPy/JAX arrays ('a = np.array((2, 1)); a.sort()...' and 'a = jnp.array((2, 1)); a_new = a.sort()...') and additional explanation ('JAX 的设计者选择将数组设为不可变的,因为 JAX 使用 [函数式编程]...这个设计选择有重要的含义,我们接下来将对此进行探讨!') that are not present in the English source. The English source's Immutability section ends with 'The designers of JAX chose to make arrays immutable because JAX uses a functional programming style, which we discuss below.'
-
速度! > ##### 使用 NumPy - Minor fluency issue: '让我们先用 NumPy 试试:' adds a colon not present in the English '让我们先用 NumPy 试试' (from 'Let's try with NumPy'). Also '再来一次。' vs source 'And one more time.' is acceptable but '再试一次。' used later is inconsistent.
-
随机数 section - Translation of 'NumPy's approach' heading context: The section heading '#### NumPy 的方法' correctly matches the source '#### NumPy's approach', but the source section is titled '#### NumPy's approach' while the translation frontmatter maps it to 'NumPy 的方法' — this is consistent and correct.
-
评估更复杂的函数 (Evaluating a more complicated function) - The translation title '评估更复杂的函数' for 'Evaluating a more complicated function' is acceptable, though '求解更复杂的函数值' might be more precise for mathematical evaluation context; however this is a minor stylistic point.
🔍 Diff Quality
| Check | Status |
|---|---|
| Scope Correct | ✅ |
| Position Correct | ❌ |
| Structure Preserved | ❌ |
| Heading-map Correct | ❌ |
| Overall | 2.5/10 |
Summary: The translation sync has several issues: obsolete JIT subsections not removed from target body, and the heading map is missing Vectorization and Autodiff entries while section ordering in map differs from source.
Issues:
- Target 'after' still retains the old '### 一个简单的示例' and '#### 更改数组大小' sections under '## JIT 编译' that should have been removed, since this content was moved to the new 'Speed!' subsection under 'Differences'
- The heading map in target 'after' is missing the 'Vectorization with
vmap' and its subsections ('A simple example', 'Combining transformations') that were present in target 'before' and still exist in the source 'after' - The heading map in target 'after' is missing the 'Automatic differentiation: a preview' entry that was present in target 'before' and still exists in source 'after'
- The 'JIT Compilation::How JIT compilation works' and 'JIT Compilation::Compiling the whole function' order in the heading map does not match the source 'after' document order (source has Compiling whole function before How JIT works)
This review was generated automatically by action-translation review mode.
There was a problem hiding this comment.
Pull request overview
Automated zh-cn translation sync for the jax_intro lecture, aligning it with upstream updates from the English source repository.
Changes:
- Adds/reshapes content in
jax_intro(new “Speed!” subsection, expanded functional-programming motivation, revised JIT discussion, and a PRNG key-splitting diagram). - Updates random-key construction examples (now using
jax.random.keyin several places). - Updates translation sync state metadata (source SHA, sync date, tool version, section count).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| lectures/jax_intro.md | Syncs lecture content with upstream, including new benchmarking/JIT narrative and new PRNG visualization code cell. |
| .translate/state/jax_intro.md.yml | Updates translation sync tracking metadata (sha/date/mode/tool version/section count). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try: | ||
| a[0] = 1 | ||
| except Exception as e: | ||
| print(e) | ||
|
|
There was a problem hiding this comment.
Catching the exception and printing only the message changes how errors are presented and diverges from the repo’s established pattern of using tags: [raises-exception] to both document the failure and keep builds deterministic (see e.g. lectures/debugging.md). Consider restoring the raises-exception tag for this cell so readers see the full exception while the build still succeeds.
| try: | |
| a[0] = 1 | |
| except Exception as e: | |
| print(e) | |
| :tags: [raises-exception] | |
| a[0] = 1 |
| ```{code-cell} ipython3 | ||
| seed = 1234 | ||
| key = jax.random.PRNGKey(seed) | ||
| key = jax.random.key(seed) |
There was a problem hiding this comment.
jax.random.key(seed) is used here, but the same lecture still uses jax.random.PRNGKey(...) later (e.g. in the exercise code), which is inconsistent and may reduce compatibility depending on the JAX version available in the build environment. Consider standardizing on one key-construction API across the lecture (or adding a brief note on the minimum JAX version required).
| key = jax.random.key(seed) | |
| key = jax.random.PRNGKey(seed) |
| ax.text(5.7, 2, "→ draw", ha='left', va='center', fontsize=10, | ||
| color='green') | ||
|
|
||
| # Label the split | ||
| ax.text(2, 2.65, "split", ha='center', va='center', fontsize=9, |
There was a problem hiding this comment.
The diagram’s on-figure labels are still in English (e.g. “→ draw”, “split”). Since this is the zh-cn lecture and translation rules mention localizing figure labels, consider translating these strings so the rendered figure matches the surrounding language.
| ```{code-cell} | ||
| def f(x): | ||
| y = np.cos(2 * x**2) + np.sqrt(np.abs(x)) + 2 * np.sin(x**4) - 0.1 * x**2 | ||
| y = np.cos(2 * x**2) + np.sqrt(np.abs(x)) + 2 * np.sin(x**4) - x**2 | ||
| return y |
There was a problem hiding this comment.
This section’s timing experiment later uses a very large n (50,000,000), which can easily exceed the 10-minute execution timeout and memory limits during Jupyter Book builds and is hard to run on typical laptops. Consider reducing the default size (and noting readers can scale it up for benchmarking) or skipping execution for the heavy timing cells.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Automated Translation Sync
This PR contains automated translations from QuantEcon/lecture-python-programming.
Source PR
#522 - Update jax_intro lecture
Files Updated
lectures/jax_intro.md.translate/state/jax_intro.md.ymlThe following sections were not modified by this source PR and are missing from the target. They have been omitted from this PR to keep it scoped to the source PR's actual changes. An earlier translation PR should add them. If that PR is abandoned, run
/translate-resyncto recover.lectures/jax_intro.md:Vectorization with \vmap`,Automatic differentiation: a preview`Details
This PR was created automatically by the translation action.