minitorch / module-0 Goto Github PK
View Code? Open in Web Editor NEWModule 0 - Fundamentals
Module 0 - Fundamentals
Would it make sense to add argparser to the run_tests.py scripts so that typing python run_tests.py --help
will give the user more instructions and make it easier to run specific tests instead of all in the module?
First, thank you for sharing this project with us!
Could you please add an explicit LICENSE
file to the repo so that it's clear
under what terms the content is provided, and under what terms user
contributions are licensed?
[...] without a license, the default copyright laws apply, meaning that you
retain all rights to your source code and no one may reproduce, distribute,
or create derivative works from your work. If you're creating an open source
project, we strongly encourage you to include an open source license.
Similar issue applies to all the other repos in this org, as none of them appear
to have specified their license.
Thanks!
After completing the assignment, I tried to install the package with:
python setup.py install
I could import the package at path ~/Module-0/
but not anywhere else. What am I doing wrong?
Besides, the implementation of named_parameters
should have a clearer description on how to reference the child parameters. I need to dive into the testing code to find out what exactly you want me to do.
Also, the final example here doesn't match the photo.
Anyway, thanks for the tutorial, it does help!!!
import minitorch
ModuleNotFoundError: No module named 'minitorch'
PS C:\Users\noahi\Documents\minitorch-module-0-coffeerow-ai\workspace\venv\module-0>
Even though the problems comes up as - "No problem have been detected in the workspace."
I finished Task 0.1-0.4 and passed the tests.
For Task 0.5: Visualization, when run streamlit run app.py -- 0
, browser shows an error:
ModuleNotFoundError: No module named 'minitorch'
Traceback:
File "/home/zeyuan/.conda/envs/torch/lib/python3.8/site-packages/streamlit/script_runner.py", line 379, in _run_script
exec(code, module.__dict__)
File "/mnt/e/workspace/Module/Module-0/project/app.py", line 3, in <module>
from interface.train import render_train_interface
File "/mnt/e/workspace/Module/Module-0/project/interface/train.py", line 5, in <module>
import graph_builder
File "/mnt/e/workspace/Module/Module-0/project/graph_builder.py", line 1, in <module>
import minitorch
How should I do to solve this problem?
After running the following commands (following the the instructions in https://minitorch.github.io/):
>>> python -m pip install -r requirements.txt
>>> python -m pip install -r requirements.extra.txt
>>> python -m pip install -Ue .
>>> conda install llvmlite
I get the following output when I run pip freeze
in my conda environment:
aiohappyeyeballs==2.4.0
aiohttp==3.10.5
aiosignal==1.3.1
altair==4.2.2
attrs==24.2.0
blinker==1.8.2
cachetools==5.5.0
certifi==2024.8.30
cfgv==3.4.0
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.3
datasets==2.4.0
dill==0.3.5.1
distlib==0.3.8
embeddings==0.0.8
entrypoints==0.4
filelock==3.15.4
frozenlist==1.4.1
fsspec==2024.6.1
gitdb==4.0.11
GitPython==3.1.43
huggingface-hub==0.24.6
hypothesis==6.54.0
identify==2.6.0
idna==3.8
importlib_metadata==8.4.0
iniconfig==2.0.0
Jinja2==3.1.4
jsonschema==4.23.0
jsonschema-specifications==2023.12.1
llvmlite==0.43.0
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
-e git+ssh://[email protected]/choo8/Module-0.git@0e47013afcb065a3bdb793536ce01359e5bd2ef8#egg=minitorch
mpmath==1.3.0
multidict==6.0.5
multiprocess==0.70.13
networkx==3.3
nodeenv==1.9.1
numba==0.60.0
numpy==2.0.0
packaging==24.1
pandas==2.2.2
pillow==10.4.0
platformdirs==4.2.2
plotly==4.14.3
pluggy==1.5.0
pre-commit==2.20.0
protobuf==3.20.3
pyarrow==17.0.0
pydeck==0.9.1
pydot==1.4.1
Pygments==2.18.0
Pympler==1.1
pyparsing==3.1.4
pytest==8.3.2
pytest-env==1.1.3
pytest-runner==5.2
python-dateutil==2.9.0.post0
python-mnist==0.7
pytz==2024.1
pywin32==306
PyYAML==6.0.2
referencing==0.35.1
requests==2.32.3
responses==0.18.0
retrying==1.3.4
rich==13.8.0
rpds-py==0.20.0
semver==3.0.2
six==1.16.0
smmap==5.0.1
sortedcontainers==2.4.0
streamlit==1.12.0
streamlit-ace==0.1.1
sympy==1.13.2
toml==0.10.2
toolz==0.12.1
torch==2.4.0
tornado==6.4.1
tqdm==4.66.5
typing_extensions==4.12.2
tzdata==2024.1
tzlocal==5.2
urllib3==2.2.2
validators==0.33.0
virtualenv==20.26.3
watchdog==1.0.2
xxhash==3.5.0
yarl==1.9.6
zipp==3.20.1
When I run streamlit run project\app.py -- 0
, I receive this error:
RuntimeError: Numpy is not available
Traceback:
File "C:\Users\cyunkeat\miniforge3\envs\minitorch\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 556, in _run_script
exec(code, module.__dict__)
File "C:\Users\cyunkeat\Desktop\ML\minitorch-workspace\Module-0\project\app.py", line 116, in <module>
page()
File "C:\Users\cyunkeat\Desktop\ML\minitorch-workspace\Module-0\project\app.py", line 57, in render_run_torch_interface
render_train_interface(TorchTrain, False)
File "C:\Users\cyunkeat\Desktop\ML\minitorch-workspace\Module-0\.\project\interface\train.py", line 84, in render_train_interface
st.write(plot())
^^^^^^
File "C:\Users\cyunkeat\Desktop\ML\minitorch-workspace\Module-0\.\project\interface\train.py", line 79, in plot
fig = plots.plot_out(dataset, contour, size=15, oned=oned)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\cyunkeat\Desktop\ML\minitorch-workspace\Module-0\.\project\interface\plots.py", line 129, in plot_out
scatters = make_scatters(graph, model, size=size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\cyunkeat\Desktop\ML\minitorch-workspace\Module-0\.\project\interface\plots.py", line 18, in make_scatters
go.Contour(
File "C:\Users\cyunkeat\miniforge3\envs\minitorch\Lib\site-packages\plotly\graph_objs\_contour.py", line 2895, in __init__
self["z"] = _v
~~~~^^^^^
File "C:\Users\cyunkeat\miniforge3\envs\minitorch\Lib\site-packages\plotly\basedatatypes.py", line 4804, in __setitem__
self._set_prop(prop, value)
File "C:\Users\cyunkeat\miniforge3\envs\minitorch\Lib\site-packages\plotly\basedatatypes.py", line 5143, in _set_prop
val = validator.validate_coerce(val)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\cyunkeat\miniforge3\envs\minitorch\Lib\site-packages\_plotly_utils\basevalidators.py", line 391, in validate_coerce
v = to_scalar_or_list(v)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\cyunkeat\miniforge3\envs\minitorch\Lib\site-packages\_plotly_utils\basevalidators.py", line 43, in to_scalar_or_list
return [to_scalar_or_list(e) for e in v]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\cyunkeat\miniforge3\envs\minitorch\Lib\site-packages\_plotly_utils\basevalidators.py", line 43, in <listcomp>
return [to_scalar_or_list(e) for e in v]
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\cyunkeat\miniforge3\envs\minitorch\Lib\site-packages\_plotly_utils\basevalidators.py", line 43, in to_scalar_or_list
return [to_scalar_or_list(e) for e in v]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\cyunkeat\miniforge3\envs\minitorch\Lib\site-packages\_plotly_utils\basevalidators.py", line 43, in <listcomp>
return [to_scalar_or_list(e) for e in v]
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\cyunkeat\miniforge3\envs\minitorch\Lib\site-packages\_plotly_utils\basevalidators.py", line 51, in to_scalar_or_list
return to_scalar_or_list(np.array(v))
^^^^^^^^^^^
File "C:\Users\cyunkeat\miniforge3\envs\minitorch\Lib\site-packages\torch\_tensor.py", line 1083, in __array__
return self.numpy()
^^^^^^^^^^^^
I resolved it by downgrading numpy
to 1.26.4
, as I saw this warning when running streamlit
:
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
This template requires
requirements.txt
However, there is no matching version for numba == 0.55
and I had to install the closest version, 0.56 instead. It requires Python < 3.11 that I used for virtual environment.
This should change to
requirements.txt
Just forked this repo, and ran into an issue where this line change causes tests to fail, even though is_close
is implemented properly (in the operators
module)
E AttributeError: module 'minitorch' has no attribute 'is_close'
E Falsifying example: test_same_as_python(
E y=0.0, x=0.0,
E )
The change was just introduced in this commit a few days ago.
Updating tests/strategies.py#17 from
assert minitorch.is_close(a, b), "Failure x=%f y=%f" % (a, b)
back to
assert minitorch.operators.is_close(a, b), "Failure x=%f y=%f" % (a, b)
appears to resolve the issue for me.
This test case at line 180 of test_operators.py tests the sum
function against itself. The sum function is imported from operators.py and no longer bound to the builtin sum
function.
@pytest.mark.task0_3
@given(lists(small_floats))
def test_sum(ls: List[float]) -> None:
assert_close(sum(ls), sum(ls))
datasets.py should have an import for “import matplotlib.pyplot as plt” at the top of it, because the assignment asks for images to be saved for readme viewing, and the saving mechanism is commented out on line 65 (presumably intentionally or as a hint) as “plt.savefig”. Or at least the import should also be commented out, or the commented plt.savefig should be deleted?
This function should probably be named gt
and the math should say f(x, y)
instead of f(x)
Module-0/minitorch/operators.py
Lines 31 to 34 in fb76a26
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.