Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosgjs committed Feb 1, 2024
1 parent d5c5542 commit 90c1099
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 73 deletions.
61 changes: 19 additions & 42 deletions notebooks/import_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"metadata": {},
"outputs": [],
"source": [
"# from azureml.core import Workspace, Datastore\n",
"from transformers import AutoModelForCausalLM, BitsAndBytesConfig, AutoTokenizer\n",
"import torch\n",
"\n",
"print(torch.cuda.is_available())"
]
},
Expand All @@ -21,7 +21,8 @@
"# model_path = \"codellama/CodeLlama-7b-Instruct-hf\"\n",
"# model_path = \"meta-llama/Llama-2-7b-chat-hf\"\n",
"model_path = \"./models/meta-llama/Llama-2-7b-chat-hf\"\n",
"print(model_path)"
"print(model_path)\n",
"target_model_path = \"carlosgjs/Llama-2-7b-chat-hf-4bit\""
]
},
{
Expand Down Expand Up @@ -58,17 +59,9 @@
"metadata": {},
"outputs": [],
"source": [
"# model.save_pretrained(f\"./models/{model_path}\")\n",
"tokenizer.save_pretrained(f\"./models/{model_path}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model.save_pretrained(f\"./models/{model_path}\")"
"# Running this requires loging into HuggingFace via `huggingface-cli login --token` using a write token\n",
"tokenizer.push_to_hub(target_model_path)\n",
"model.push_to_hub(target_model_path)"
]
},
{
Expand All @@ -77,43 +70,27 @@
"metadata": {},
"outputs": [],
"source": [
"# Alternatvely, upload to Azure Blob Storage\n",
"from azureml.core import Workspace\n",
"\n",
"# save locally first\n",
"tokenizer.save_pretrained(f\"./models/{model_path}\")\n",
"model.save_pretrained(f\"./models/{model_path}\")\n",
"\n",
"# If all goes well, upload to blob storage:\n",
"workspace = Workspace.from_config()\n",
"ds = workspace.get_default_datastore()\n",
"ds.upload(f\"./models/{model_path}\", f\"./base_models/{model_path}\", show_progress=True, overwrite=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model.push_to_hub(\"carlosgjs/Llama-2-7b-chat-hf-4bit\")"
"ds.upload(\n",
" f\"./models/{target_model_path}\", f\"./base_models/{target_model_path}\", show_progress=True, overwrite=True\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"tokenizer.push_to_hub(\"carlosgjs/Llama-2-7b-chat-hf-4bit\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "autodoc",
"display_name": ".env",
"language": "python",
"name": "autodoc"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -125,7 +102,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
48 changes: 17 additions & 31 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
[project]
name = "autora-doc"
license = {file = "LICENSE"}
license = { file = "LICENSE" }
readme = "README.md"
authors = [
{ name = "Carlos Garcia Jurado Suarez", email = "[email protected]" }
]
authors = [{ name = "Carlos Garcia Jurado Suarez", email = "[email protected]" }]
requires-python = ">=3.8"
classifiers = [
"Development Status :: 4 - Beta",
Expand All @@ -29,36 +27,26 @@ description = "Automatic documentation generator from AutoRA code"
[project.optional-dependencies]
dev = [
"pytest",
"pytest-cov", # Used to report total code coverage
"pre-commit", # Used to run checks before finalizing a git commit
"sphinx", # Used to automatically generate documentation
"pytest-cov", # Used to report total code coverage
"pre-commit", # Used to run checks before finalizing a git commit
"sphinx", # Used to automatically generate documentation
"sphinx-rtd-theme", # Used to render documentation
"sphinx-autoapi", # Used to automatically generate api documentation
"black", # Used for static linting of files
"mypy", # Used for static type checking of files
"sphinx-autoapi", # Used to automatically generate api documentation
"black", # Used for static linting of files
"mypy", # Used for static type checking of files
# if you add dependencies here while experimenting in a notebook and you
# want that notebook to render in your documentation, please add the
# dependencies to ./docs/requirements.txt as well.
"nbconvert", # Needed for pre-commit check to clear output from Python notebooks
"nbsphinx", # Used to integrate Python notebooks into Sphinx documentation
"ipython", # Also used in building notebooks into Sphinx
"matplotlib", # Used in sample notebook intro_notebook.ipynb
"nbconvert", # Needed for pre-commit check to clear output from Python notebooks
"nbsphinx", # Used to integrate Python notebooks into Sphinx documentation
"ipython", # Also used in building notebooks into Sphinx
"matplotlib", # Used in sample notebook intro_notebook.ipynb
"ipykernel",
"hf_transfer",
]
train = [
"jsonlines",
"mlflow",
]
azure = [
"azureml-core",
"azureml-mlflow",
]
cuda = [
"bitsandbytes>=0.42.0",
"accelerate>=0.24.1",
"xformers",
]
train = ["jsonlines", "mlflow"]
azure = ["azureml-core", "azureml-mlflow"]
cuda = ["bitsandbytes>=0.42.0", "accelerate>=0.24.1", "xformers"]

[project.urls]
Homepage = "https://github.com/AutoResearch/autodoc"
Expand All @@ -68,9 +56,7 @@ requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[tool.pytest.ini_options]
testpaths = [
"tests",
]
testpaths = ["tests"]

[tool.black]
line-length = 110
Expand All @@ -81,7 +67,7 @@ profile = "black"
line_length = 110

[tool.coverage.run]
omit=["src/autora/doc/_version.py"]
omit = ["src/autora/doc/_version.py"]

[tool.hatch]

Expand Down

0 comments on commit 90c1099

Please sign in to comment.