Open allg00d opened 8 months ago
I couldn't reproduce the issue, but I coded up what should hopefully be a workaround. Try updating to the local branch by running
pip install git+https://github.com/helblazer811/ManimML.git
It got further, but ended up with the same exception.
Constructing layers Current layer: Convolutional2DLayer Current layer: Convolutional2DLayer Current layer: Convolutional2DLayer Current layer: FeedForwardLayer Current layer: FeedForwardLayer
Now it is running into the same issue when it tries to construct NeuralNetwork at line 17 in the example.
BTW, this seems like it would great to use in my ML course at Berkeley. The students definitely struggle with visualizing this stuff.
Could you try putting print(DEFAULT_FONT_SIZE)
at the top of the script after the manim import. I'm wondering if it is not divisible by 3 and that is causing issues. I got 48 on my system.
I am also getting 48.
On Sat, Nov 4, 2023 at 11:43 AM Alec Helbling @.***> wrote:
Could you try putting print(DEFAULT_FONT_SIZE) at the top of the script after the manim import. I'm wondering if it is not divisible by 3 and that is causing issues. I got 48 on my system.
— Reply to this email directly, view it on GitHub https://github.com/helblazer811/ManimML/issues/41#issuecomment-1793517935, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAY6KKV4AYJT7ANR7VMRDQTYC2EFBAVCNFSM6AAAAAA65XYFHKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJTGUYTOOJTGU . You are receiving this because you authored the thread.Message ID: @.***>
Hmmm. Quite strange. The stack trace has the same error on line 10 of parent_layers.py?
I changed the division to integer division to see if that changes things.
Try installing again pip install git+https://github.com/helblazer811/ManimML.git
Also, integrating this into a course sounds amazing. Let me know if there is a way that I can help with that. I plan multiple extensions of this project in the future.
It seems like TEXT2SVG_ADJUSTMENT_FACTOR is set to 4.8 and is dividing the size in the _text2svg function so the size ends up 5.0. So I casted both size and line_spacing to ints. Then I got another type error at in manimpango.cmanimpango.text2svg:142 <TypeError: Expected int, got str>.
On Sat, Nov 4, 2023 at 11:49 AM Alec Helbling @.***> wrote:
Hmmm. Quite strange. The stack trace has the same error on line 10 of parent_layers.py?
I changed the division to integer division to see if that changes things.
Try installing again pip install git+ https://github.com/helblazer811/ManimML.git
Also, integrating this into a course sounds amazing. Let me know if there is a way that I can help with that. I plan multiple extensions of this project in the future.
— Reply to this email directly, view it on GitHub https://github.com/helblazer811/ManimML/issues/41#issuecomment-1793521892, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAY6KKQICV2UXZOW4SERFSLYC2E3NAVCNFSM6AAAAAA65XYFHKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJTGUZDCOBZGI . You are receiving this because you authored the thread.Message ID: @.***>
I think perhaps your system is using this manimpango dependency to render text instead of Latex, which is what my system is doing (I also have an M1 Macbook Pro).
Do you know what version of manimpango you have?
pip list | grep ManimPango
0.4.4
On Sat, Nov 4, 2023 at 12:19 PM Alec Helbling @.***> wrote:
I think perhaps your system is using this manimpango dependency to render text instead of Latex, which is what my system is doing (I also have an M1 Macbook Pro).
Do you know what version of manimpango you have?
pip list | grep ManimPango
— Reply to this email directly, view it on GitHub https://github.com/helblazer811/ManimML/issues/41#issuecomment-1793532487, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAY6KKS7UJLLADMVG7FOVMTYC2IMRAVCNFSM6AAAAAA65XYFHKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJTGUZTENBYG4 . You are receiving this because you authored the thread.Message ID: @.***>
Perhaps try running pip install -U manimpango
I think it may be the ManimPango does not allow for non-integer sizes because of how it is coded under the hood. And the reason my code works is because it may not be using this dependency. Let me see if I can just ensure for the code you are running that the text font sizes are integer.
I think this may be related. https://github.com/ManimCommunity/ManimPango/issues/106
I also had the same issue with manimpango. I could not make it work even with downgrading manimpango (It caused a more serious issue).
For now I just tried to get away with casting both size
and line_spacing
.
I am just trying to run the first example in the Readme.md. I am running on an M1 Pro Mac. I did a conda install of Manim Community v0.17.3 and pip install of the python library (manim 0.17.3, manim-ml 0.0.24). I am getting the following TypeError:
Manim Community v0.17.3
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /Blah/lib/python3.10/site-packages/manim/cli/render/command │ │ s.py:115 in render │ │ │ │ 112 │ │ │ try: │ │ 113 │ │ │ │ with tempconfig({}): │ │ 114 │ │ │ │ │ scene = SceneClass() │ │ ❱ 115 │ │ │ │ │ scene.render() │ │ 116 │ │ │ except Exception: │ │ 117 │ │ │ │ error_console.print_exception() │ │ 118 │ │ │ │ sys.exit(1) │ │ │ │ /Blah/lib/python3.10/site-packages/manim/scene/scene.py:223 │ │ in render │ │ │ │ 220 │ │ """ │ │ 221 │ │ self.setup() │ │ 222 │ │ try: │ │ ❱ 223 │ │ │ self.construct() │ │ 224 │ │ except EndSceneEarlyException: │ │ 225 │ │ │ pass │ │ 226 │ │ except RerunSceneException as e: │ │ │ │ /Blah/manim_test.py:18 in │ │ construct │ │ │ │ 15 │ def construct(self): │ │ 16 │ │ # Make the neural network │ │ 17 │ │ nn = NeuralNetwork([ │ │ ❱ 18 │ │ │ │ Convolutional2DLayer(int(1), int(7), int(3), filter_spacing=0.32), │ │ 19 │ │ │ │ Convolutional2DLayer(int(3), int(5), int(3), filter_spacing=0.32), │ │ 20 │ │ │ │ Convolutional2DLayer(int(5), int(3), int(3), filter_spacing=0.18), │ │ 21 │ │ │ │ FeedForwardLayer(3), │ │ │ │ /Blah/lib/python3.10/site-packages/manim_ml/neural_network/ │ │ layers/convolutional_2d.py:128 in init │ │ │ │ 125 │ │ padding_dashed=True, │ │ 126 │ │ kwargs, │ │ 127 │ ): │ │ ❱ 128 │ │ super().init(kwargs) │ │ 129 │ │ self.num_feature_maps = num_feature_maps │ │ 130 │ │ self.filter_color = filter_color │ │ 131 │ │ if isinstance(padding, tuple): │ │ │ │ /Blah/lib/python3.10/site-packages/manim_ml/neural_network/ │ │ layers/parent_layers.py:46 in init │ │ │ │ 43 │ │ 44 class VGroupNeuralNetworkLayer(NeuralNetworkLayer): │ │ 45 │ def init(self, *args, kwargs): │ │ ❱ 46 │ │ super().init(*args, *kwargs) │ │ 47 │ │ # self.camera = camera │ │ 48 │ │ │ 49 │ @abstractmethod │ │ │ │ /Blah/lib/python3.10/site-packages/manim_ml/neural_network/ │ │ layers/parent_layers.py:10 in init │ │ │ │ 7 │ def init(self, text=None, args, kwargs): │ │ 8 │ │ super(Group, self).init() │ │ 9 │ │ self.title_text = kwargs["title"] if "title" in kwargs else " " │ │ ❱ 10 │ │ self.title = Text(self.title_text, font_size=DEFAULT_FONT_SIZE / 3).scale(0.6) │ │ 11 │ │ self.title.nextto(self, UP, 1.2) │ │ 12 │ │ # self.add(self.title) │ │ 13 │ │ │ │ /Blah/lib/python3.10/site-packages/manim/mobject/text/text │ │ mobject.py:486 in init │ │ │ │ 483 │ │ │ self.line_spacing = self._font_size + self._font_size * self.line_spacing │ │ 484 │ │ │ │ 485 │ │ color = Color(color) if color else VMobject().color │ │ ❱ 486 │ │ file_name = self._text2svg(color) │ │ 487 │ │ PangoUtils.remove_last_M(file_name) │ │ 488 │ │ super().init( │ │ 489 │ │ │ filename, │ │ │ │ /Blah/lib/python3.10/site-packages/manim/mobject/text/text │ │ mobject.py:814 in _text2svg │ │ │ │ 811 │ │ │ width = config["pixel_width"] │ │ 812 │ │ │ height = config["pixel_height"] │ │ 813 │ │ │ │ │ ❱ 814 │ │ │ svg_file = manimpango.text2svg( │ │ 815 │ │ │ │ settings, │ │ 816 │ │ │ │ size, │ │ 817 │ │ │ │ line_spacing, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ TypeError: Argument 'size' has incorrect type (expected int, got float)