$$y = f(x)$$ means that one can consider parametrization
\begin{align}
&x = q\\
&y = f(q)
\end{align}
Let us assume the marble rolls along the curve without friction and it is always in contact with the curve $y = f(x)$, whose radius of curvature is bigger the the marble's radius.
A unit vector, tangent to the curve at a point $(q, \, f(q))$ is
$$\left(\frac{1}{\sqrt{1+f'(q)^2\,}\,}\,,\,\,\, \frac{f'(q)}{\sqrt{1+f'(q)^2\,}\,}\right)$$ and hence, a unit vector normal (i.e. perpendicular) to the curve at point $(q, \, f(q))$ is
$$\left(-\,\frac{f'(q)}{\sqrt{1+f'(q)^2\,}\,}\,,\,\,\, \frac{1}{\sqrt{1+f'(q)^2\,}\,}\right)$$
The position of the marble's center of mass is
\begin{align}
&x \,=\, q\,-\,\frac{r\,f'(q)}{\sqrt{1+f'(q)^2\,}\,}\\
&y \,=\,f(q)\,+\,\frac{r}{\sqrt{1+f'(q)^2\,}\,}
\end{align}
and its velocity can be expressed as
\begin{align}
&\frac{dx}{dt}\,=\, \left(\, 1 \,-\,\frac{r\,f''(q)}{\sqrt{1+f'(q)^2\,}\,} \,+\, \frac{r\,f'(q)^2f''(q)}{\big(\,1 + f'(q)^2\,\big)^{\frac{3}{2}}}\,\right) \frac{dq}{dt}\\
&\frac{dy}{dt} \,=\, \left(\,f'(q)\,-\,\frac{r\,f'(q)f''(q)}{\big(\,1 + f'(q)^2\,\big)^{\frac{3}{2}}} \,\right) \frac{dq}{dt}
\end{align}
Abbreviate
\begin{align}
&V(q) \,=\, 1 \,-\,\frac{r\,f''(q)}{\sqrt{1+f'(q)^2\,}\,} \,+\, \frac{r\,f'(q)^2f''(q)}{\big(\,1 + f'(q)^2\,\big)^{\frac{3}{2}}}\\
&W(q) \,=\,f'(q)\,-\,\frac{r\,f'(q)f''(q)}{\big(\,1 + f'(q)^2\,\big)^{\frac{3}{2}}}
\end{align}
and thus
\begin{align}
&\frac{dx}{dt}\,=\, V(q) \, \frac{dq}{dt}\\
&\frac{dy}{dt} \,=\, W(q) \, \frac{dq}{dt}
\end{align}
The angular velocity of the marble from rotation is related to the arclength traversed by the marble as follows:
$$r\,\frac{d\varphi}{dt}\,=\, \frac{ds}{dt} \,=\, \sqrt{1 + f'(q)^2\,}\,\frac{dq}{dt}$$
which can be denoted by
$$S(q) \,=\, \sqrt{1 + f'(q)^2\,}$$
$$r\,\frac{d\varphi}{dt} \,=\, S(q)\,\frac{dq}{dt}$$
The kinetic and potential energy of the marble are
\begin{align}
T \,=\, \frac{m}{2} \left(\,\Big(\frac{dx}{dt}\Big)^2 +\, \Big(\frac{dy}{dt}\Big)^2\,\right) \,+\, \frac{I}{2} \Big(\frac{d\varphi}{dt}\Big)^2
\end{align}
$$U \,=\, gm\,y$$
Express the kinetic and potential energy in terms of the coordinate $q$:
$$T(q) \,=\, m\Big(\,V(q)^2 +\, W(q)^2\,\Big) \,+\, \frac{I}{r^2} \,S(q)^2$$
\begin{align}
T\,=\,\frac{1}{2}\,T(q) \,\Big(\frac{dq}{dt}\Big)^2 \,=\, \left(\,\frac{m}{2} \Big(\,V(q)^2 +\, W(q)^2\,\Big) \,+\, \frac{I}{2r^2} \,S(q)^2 \right) \Big(\frac{dq}{dt}\Big)^2
\end{align}
$$U(q) \,=\, gm\,\left(\,f(q)\,+\,\frac{r}{\sqrt{1+f'(q)^2\,}\,}\,\right)$$
Now, to form the eqation of motion, one can go about it in, say, two ways. One can write the Lagrangian of the system
$$L \,=\,\frac{1}{2}\, T(q) \,\Big(\frac{dq}{dt}\Big)^2 \,-\, U(q)$$
and derive the Euler-Legrange second order differential equation:
$$\frac{d}{dt} \left(\,T(q) \,\Big(\frac{dq}{dt}\Big)\,\right) \,=\, \frac{1}{2}\, T'(q) \,\Big(\frac{dq}{dt}\Big)^2\,-\, U'(q)$$
which can be rewritten in the form
$$T(q) \,\frac{d^2q}{dt^2} \, + \, \frac{1}{2}\, T'(q) \,\Big(\frac{dq}{dt}\Big)^2 \,+\, U'(q) \,=\, 0$$
You could also use the conservation of energy, i.e.
$$\frac{1}{2}\, T(q) \,\Big(\frac{dq}{dt}\Big)^2 \,+\, U(q) \,=\, E_0$$ where $E_0 \,=\, U(q_0)$ is the constant determined by the initial position of the marble with zero initial velocity: $x_0 = q_0$ and $y_0 = f(q_0)$. After solvling for the derivative of $q=q(t)$
$$\frac{dq}{dt}\,=\, \pm\, \sqrt{\,\frac{2\,E_0 \,-\, 2\,U(q)}{T(q)} \,}$$
The expressions for the functions involved in the right hand side of the equation are fairly heavy. One can achieve a simplification by setting $r \to 0$.