2. If the function $f(x)$ is an odd function with a period of 3, and when $x \in[0,1)$, $f(x)=3^{x}-1$, then $f\left(\log _{\frac{1}{3}} 54\right)=$ $\qquad$ .
2. -1 .

Notice that,
$$
\log _{\frac{1}{3}} 54=\log _{\frac{1}{3}} 27+\log _{\frac{1}{3}} 2=-3-\log _{3} 2 \text {, }
$$
and $f(x)$ has a period of 3.
Therefore, $f\left(\log _{\frac{1}{3}} 54\right)=f\left(-\log _{3} 2\right)$.
Furthermore, since $f(x)$ is an odd function and $\log _{3} 2 \in[0,1)$, we have
$$
\begin{array}{l}
f\left(\log _{\frac{1}{3}} 54\right)=f\left(-\log _{3} 2\right)=-f\left(\log _{3} 2\right) \\
=-\left(3^{\log _{3} 2}-1\right)=-1 .
\end{array}
$$