Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prakharjadaun/python-necessary-commands
Repo contains several commands which can be helpful in ML projects.
https://github.com/prakharjadaun/python-necessary-commands
conda huggingface keras langchain pip
Last synced: about 4 hours ago
JSON representation
Repo contains several commands which can be helpful in ML projects.
- Host: GitHub
- URL: https://github.com/prakharjadaun/python-necessary-commands
- Owner: prakharjadaun
- Created: 2024-04-19T12:12:00.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-04-21T06:00:08.000Z (7 months ago)
- Last Synced: 2024-05-11T05:56:12.640Z (6 months ago)
- Topics: conda, huggingface, keras, langchain, pip
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# **Python Necessary Commands**
This repository contains several commands which can be helpful in ML projects and you should know.
## Pip
- To upgrade pip
```
python -m pip install --upgrade pip
```
- To check the version of pip
```
pip --version
```
- To downgrade the pip version
```
python -m pip install pip==version_name
```
- To get all the packages installed, along with their specific version and location.
```
pip list
```
- To resolve conflicts when installing requirements.txt using pip
```
!pip install -r requirements.txt --use-deprecated=legacy-resolver
```
## Conda- To create a virtual environment using conda (you can use any version of python)
```
conda create -p venv python==3.10.0 -y
```
- To activate a virtual environment you created locally (venv is the name of virtual env)
```
conda activate venv/
```
- If pip not working in virtual env ([source](https://stackoverflow.com/questions/37220055/pip-fatal-error-in-launcher-unable-to-create-process-using))
```
python -m pip install --upgrade --force-reinstall pip
```
## Keras- To save keras model
```
# after training
model.save("model_name.h5")
```
- To load the keras model
```
model = keras.models.load_model("model_name.h5")
```
- To save keras model's weight
```
model.save_weights("model_weights.h5")
```
- To load the weights
```
model.load_weights("model_weights.h5)
```
- To save the architecture as json
```
json_string = model.to_json()
with open("filename","w") as f:
f.write(json_string)
```
- To load the json file:
```
with open("filename","r") as f:
loaded_json_string = f.read();
```
## HuggingFace- Remove downloaded Tensorflow and Pytorch(HuggingFace) Models ([source](https://stackoverflow.com/questions/65037368/remove-downloaded-tensorflow-and-pytorchhugging-face-models))
```
huggingface-cli delete-cache
```