Let $f\colon X\to Y$ be a finite morphism between two smooth irreducible varieties over an algebraically closed field $k$. Let $x\in X$ be a (closed) point, and $y = f(x)$. Define the multiplicity of $f$ at $x$ to be $m_f(x) := \dim_k\mathcal{O}_{X,x}/M_y\mathcal{O}_{X,x}$ where here $\mathcal{O}_{X,x}$ is the local ring of $X$ at $x$, and $M_y$ is the maximal ideal in the local ring $\mathcal{O}_{Y,y}$ of $Y$ at $y$, viewed as a subring of $\mathcal{O}_{X,x}$ via the pullback $f^*$.

I have been told that the function $m_f\colon X\to\mathbb{N}$ is Zariski upper semicontinuous, but am having trouble coming up with a proof or finding a reference. Does anyone have a reference or an argument for why this is true? It seems like the natural thing to do would be to find a coherent sheaf on $X$ whose fiber at $x$ has dimension $m_f(x)$, but which sheaf?