google-deepmind / mathematics_dataset

This dataset code generates mathematical question and answer pairs, from a range of question types at roughly school-level difficulty.
Apache License 2.0
1.8k stars 249 forks source link

Refactor polynomial sampling code for compatibility #19

Open felixboelter opened 4 months ago

felixboelter commented 4 months ago

Description

Files Changed

Detailed Changes

  1. Import Path Update:

    • Changed (Edit):
      from sympy.solvers.diophantine import base_solution_linear as diophantine_solve_linear_2d

      to:

      try:
       from sympy.solvers.diophantine.diophantine import base_solution_linear as diophantine_solve_linear_2d
      except ImportError:
       from sympy.solvers.diophantine import base_solution_linear as diophantine_solve_linear_2d
  2. Numpy Dtype Adjustment:

    • Updated dtype from np.object to object in the following lines:
      expanded_coefficients = np.empty(shape, dtype=np.object)

      to:

      expanded_coefficients = np.empty(shape, dtype=object)
    • Similarly, adjusted dtype in:
      coefficients_1 = np.zeros(coefficients.shape, dtype=np.object)
      coefficients_2 = np.zeros(coefficients.shape, dtype=np.object)

      to:

      coefficients_1 = np.zeros(coefficients.shape, dtype=object)
      coefficients_2 = np.zeros(coefficients.shape, dtype=object)
davidsaxton commented 4 months ago

Will this import work with older versions of sympy? If not - could it be changed to have some conditional import depending on version (or e.g. try: ... except ImportError: ...) Thanks!