Git Product home page Git Product logo

models's Introduction

https://github.com/unifyai/unifyai.github.io/blob/main/img/externally_linked/logo.png?raw=true#gh-light-mode-only

https://github.com/unifyai/unifyai.github.io/blob/main/img/externally_linked/logo_dark.png?raw=true#gh-dark-mode-only



Ivy Models

This repository houses a collection of popular machine learning models written in the Ivy framework.

Code written in Ivy is compatible with PyTorch, TensorFlow, JAX and NumPy. This means that these models can be integrated into a working pipeline for any of these standard ML frameworks.

The purpose of this repository is to provide reference Ivy implementations of common machine learning models, as well as giving a demonstration of how to write custom models in Ivy.

Check out our demos to see these models in action. In particular, UNet and AlexNet demonstrate using models from this repository.

The models can be loaded with pretrained weights, we have tests to ensure that our models give the same output as the reference implementation. Models can also be initialised with random weights by passing pretrained=False to the loading function.

To learn more about Ivy, check out unify.ai, our Docs, and our GitHub.

Setting up

git clone https://github.com/unifyai/models
cd models
pip install .

Getting started

import ivy
from ivy_models import alexnet
ivy.set_backend("torch")
model = alexnet()

The pretrained AlexNet model is now ready to be used, and is compatible with any other PyTorch code. See this demo for more details.

Navigating this repository

The models are contained in the ivy_models folder. The functions that automatically load the pretrained weights are found at the end of model_name.py, some models have multiple sizes. The layers are sometimes kept in a separate file, usually named layers.py.

Off-the-shelf models for a variety of domains.


Ivy Libraries

There are a host of derived libraries written in Ivy, in the areas of mechanics, 3D vision, robotics, gym environments, neural memory, pre-trained models + implementations, and builder tools with trainers, data loaders and more. Click on the icons below to learn more!


Citation

@article{lenton2021ivy,
  title={Ivy: Templated deep learning for inter-framework portability},
  author={Lenton, Daniel and Pardo, Fabio and Falck, Fabian and James, Stephen and Clark, Ronald},
  journal={arXiv preprint arXiv:2102.02886},
  year={2021}
}

models's People

Contributors

djl11 avatar juliagsy avatar abdulasiraj avatar haidersultanarc avatar ivy-branch avatar muhammedashraf2020 avatar kareemmax avatar rashulchutani avatar vedpatwardhan avatar tomatillos avatar mosesdaudu001 avatar modanesh avatar ritujapawas avatar mohame54 avatar rishabgit avatar shireenchand avatar sarvesh-kesharwani avatar mattbarrett98 avatar bicycleman15 avatar mahmoudashraf97 avatar rush2406 avatar aarsh2001 avatar hello-fri-end avatar bipinkrishnan avatar mobley-trent avatar madjid-ch avatar catb1t avatar selvaraj-sembulingam avatar yushaarif99 avatar zaeemansari70 avatar

Stargazers

 avatar AMINAT ODEDEYI avatar Rubanza Silver avatar Ayesha Irshad avatar Luc Atakpa avatar Shitty Girl avatar  avatar  avatar Muhammad Ishaque Nizamani avatar jinyuan sun avatar  avatar Binh Le avatar Adam Markiewicz avatar Garima Saroj avatar Abdullah Alshadadi avatar Jacob Valdez avatar ManuπŸ“ŽπŸ“Ž avatar muriuki muriungi erick avatar Muhriddin  avatar Etch avatar Marouf Shaikh avatar Fabion Kauker avatar

Watchers

Nightcrab avatar Valerio Costantino avatar  avatar  avatar  avatar  avatar Abdurrahman Rajab avatar Vaibhav Thakkar avatar  avatar Sladyn avatar  avatar  avatar Suvaditya Mukherjee avatar  avatar Fayad Alman avatar

models's Issues

Error with serializing configs of efficientnet while pushing model to HF

model_name = "efficientnet_b0"
​
imported_model1.push_to_huggingface(
repo_id=f"unifyai/{model_name}",
config_path = "config.json",
model_path = "model.pkl",
weights_path = "weights.hdf5",
repo_type = "model",
token = "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",
private = False,
revision = None,
commit_message = "adds {model_name} model",
commit_description = "Adding {model_name} model, config(specs), and weights",
create_pr= False,
safe_serialization = False,
push_config = True,
push_model = True,
push_weights = True,
)

Pushing config to Hugging Face...

TypeError Traceback (most recent call last)
Cell In[19], line 3
1 model_name = "efficientnet_b0"
----> 3 imported_model1.push_to_huggingface(
4 repo_id=f"unifyai/{model_name}",
5 config_path = "config.json",
6 model_path = "model.pkl",
7 weights_path = "weights.hdf5",
8 repo_type = "model",
9 token = "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",
10 private = False,
11 revision = None,
12 commit_message = "adds {model_name} model",
13 commit_description = "Adding {model_name} model, config(specs), and weights",
14 create_pr= False,
15 safe_serialization = False,
16 push_config = True,
17 push_model = True,
18 push_weights = True,
19 )

File /opt/conda/lib/python3.10/site-packages/ivy_models/base/model.py:72, in BaseModel.push_to_huggingface(self, repo_id, config_path, model_path, weights_path, repo_type, token, private, revision, commit_message, commit_description, create_pr, safe_serialization, push_config, push_model, push_weights)
70 if push_config:
71 print("Pushing config to Hugging Face...")
---> 72 self.spec.to_json_file()
73 api.upload_file(
74 path_or_fileobj=config_path,
75 repo_id=repo_id,
76 path_in_repo=config_path,
77 repo_type=repo_type,
78 )
79 os.remove(config_path)

File /opt/conda/lib/python3.10/site-packages/ivy_models/base/spec.py:77, in BaseSpec.to_json_file(self, save_directory)
75 os.makedirs(save_directory, exist_ok=True)
76 with open(os.path.join(save_directory, "config.json"), "w") as f:
---> 77 json.dump(self.dict, f)
78 print("Saved to directory:", save_directory)

File /opt/conda/lib/python3.10/json/init.py:179, in dump(obj, fp, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
173 iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,
174 check_circular=check_circular, allow_nan=allow_nan, indent=indent,
175 separators=separators,
176 default=default, sort_keys=sort_keys, **kw).iterencode(obj)
177 # could accelerate with writelines in some versions of Python, at
178 # a debuggability cost
--> 179 for chunk in iterable:
180 fp.write(chunk)

File /opt/conda/lib/python3.10/json/encoder.py:431, in _make_iterencode.._iterencode(o, _current_indent_level)
429 yield from _iterencode_list(o, _current_indent_level)
430 elif isinstance(o, dict):
--> 431 yield from _iterencode_dict(o, _current_indent_level)
432 else:
433 if markers is not None:

File /opt/conda/lib/python3.10/json/encoder.py:405, in _make_iterencode.._iterencode_dict(dct, _current_indent_level)
403 else:
404 chunks = _iterencode(value, _current_indent_level)
--> 405 yield from chunks
406 if newline_indent is not None:
407 _current_indent_level -= 1

File /opt/conda/lib/python3.10/json/encoder.py:325, in _make_iterencode.._iterencode_list(lst, _current_indent_level)
323 else:
324 chunks = _iterencode(value, _current_indent_level)
--> 325 yield from chunks
326 if newline_indent is not None:
327 _current_indent_level -= 1

File /opt/conda/lib/python3.10/json/encoder.py:438, in _make_iterencode.._iterencode(o, _current_indent_level)
436 raise ValueError("Circular reference detected")
437 markers[markerid] = o
--> 438 o = _default(o)
439 yield from _iterencode(o, _current_indent_level)
440 if markers is not None:

File /opt/conda/lib/python3.10/json/encoder.py:179, in JSONEncoder.default(self, o)
160 def default(self, o):
161 """Implement this method in a subclass such that it returns
162 a serializable object for o, or calls the base implementation
163 (to raise a TypeError).
(...)
177
178 """
--> 179 raise TypeError(f'Object of type {o.class.name} '
180 f'is not JSON serializable')

TypeError: Object of type MBConvConfig is not JSON serializable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.