You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a HuggingFace user access token [as documented here](https://huggingface.co/docs/hub/en/security-tokens).
71
71
Log into huggingface:
72
72
```
@@ -216,7 +216,7 @@ For more details on quantization and what settings to use for your use
216
216
case visit our [Quanitization documentation](docs/quantization.md) or
217
217
run `python3 torchchat.py export`
218
218
219
-
[end default]:
219
+
[end default]:
220
220
221
221
### Deploy and run on iOS
222
222
@@ -315,17 +315,50 @@ files.
315
315
While we describe how to use torchchat using the popular llama3 model,
316
316
you can perform the example commands with any of these models.
317
317
318
+
319
+
## Design Principles
320
+
321
+
torchtune embodies PyTorch’s design philosophy [[details](https://pytorch.org/docs/stable/community/design.html)], especially "usability over everything else".
322
+
323
+
### Native PyTorch
324
+
325
+
torchchat is a native-PyTorch library. While we provide integrations with the surrounding ecosystem (eg: Hugging Face models, etc), all of the core functionality is written in PyTorch.
326
+
327
+
### Simplicity and Extensibility
328
+
329
+
torchchat is designed to be easy to understand, use and extend.
330
+
331
+
- Composition over implementation inheritance - layers of inheritance for code re-use makes the code hard to read and extend
332
+
- No training frameworks - explicitly outlining the training logic makes it easy to extend for custom use cases
333
+
- Code duplication is preferred over unnecessary abstractions
334
+
- Modular building blocks over monolithic components
335
+
336
+
### Correctness
337
+
338
+
torchchat provides well-tested components with a high-bar on correctness.
339
+
We provide
340
+
341
+
- Extensive unit-tests to ensure things operate as they should
342
+
343
+
## Community Contributions
344
+
345
+
We really value our community and the contributions made by our wonderful users. We'll use this section to call out some of these contributions! If you'd like to help out as well, please see the [CONTRIBUTING](docs/CONTRIBUTING.md) guide.
346
+
318
347
## Troubleshooting
319
348
320
349
321
350
**CERTIFICATE_VERIFY_FAILED**
322
351
Run `pip install --upgrade certifi`.
323
352
324
353
325
-
**Access to model is restricted and you are not in the authorized
326
-
list**Some models require an additional step to access. Follow the
354
+
**Access to model is restricted and you are not in the authorized list**
355
+
Some models require an additional step to access. Follow the
327
356
link provided in the error to get access.
328
357
358
+
**Installing ET Fails**
359
+
If `./scripts/install_et.sh` fails with an error like `Building wheel for executorch (pyproject.toml) did not run successfully` It's possible that it's linking to an older version of pytorch installed some other way like via homebrew. You can break the link by uninstalling other versions such as `brew uninstall pytorch` Note: You may break something that depends on this, so be aware.
360
+
361
+
329
362
### Disclaimer
330
363
The torchchat Repository Content is provided without any guarantees
331
364
about performance or compatibility. In particular, torchchat makes
@@ -344,18 +377,18 @@ solely responsible for complying with all such obligations.
344
377
345
378
346
379
### Disclaimer
347
-
The torchchat Repository Content is provided without any guarantees about
348
-
performance or compatibility. In particular, torchchat makes available
349
-
model architectures written in Python for PyTorch that may not perform
350
-
in the same manner or meet the same standards as the original versions
351
-
of those models. When using the torchchat Repository Content, including
352
-
any model architectures, you are solely responsible for determining the
353
-
appropriateness of using or redistributing the torchchat Repository Content
354
-
and assume any risks associated with your use of the torchchat Repository Content
355
-
or any models, outputs, or results, both alone and in combination with
356
-
any other technologies. Additionally, you may have other legal obligations
357
-
that govern your use of other content, such as the terms of service for
358
-
third-party models, weights, data, or other technologies, and you are
380
+
The torchchat Repository Content is provided without any guarantees about
381
+
performance or compatibility. In particular, torchchat makes available
382
+
model architectures written in Python for PyTorch that may not perform
383
+
in the same manner or meet the same standards as the original versions
384
+
of those models. When using the torchchat Repository Content, including
385
+
any model architectures, you are solely responsible for determining the
386
+
appropriateness of using or redistributing the torchchat Repository Content
387
+
and assume any risks associated with your use of the torchchat Repository Content
388
+
or any models, outputs, or results, both alone and in combination with
389
+
any other technologies. Additionally, you may have other legal obligations
390
+
that govern your use of other content, such as the terms of service for
391
+
third-party models, weights, data, or other technologies, and you are
359
392
solely responsible for complying with all such obligations.
360
393
361
394
@@ -401,4 +434,3 @@ code in this distribution is covered by the MIT and Apache Open Source
401
434
licenses.) However you may have other legal obligations that govern
402
435
your use of content, such as the terms of service for third-party
We want to make contributing to this project as easy and transparent as possible.
3
+
4
+
5
+
6
+
## Dev install
7
+
You should first [fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) the torchchat repository
1. Create your new branch from `main` in your forked repo, with a name describing the work you're completing e.g. `add-feature-x`.
44
+
2. If you've added code that should be tested, add tests. Ensure all tests pass. See the [testing section](#testing) for more information.
45
+
3. If you've changed APIs, [update the documentation](#updating-documentation).
46
+
4. Make sure your [code lints](#coding-style).
47
+
5. If you haven't already, complete the [Contributor License Agreement ("CLA")](#contributor-license-agreement-cla)
48
+
49
+
50
+
51
+
## Testing
52
+
TODO: Fill out the details
53
+
54
+
-**Unit tests**
55
+
TODO: Fillout the details
56
+
57
+
58
+
59
+
## Updating documentation
60
+
Each API and class should be clearly documented. Well-documented code is easier to review and understand/extend. All documentation is contained in the [docs directory](docs/):
61
+
62
+
63
+
Documentation is written in [RST](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html) format.
64
+
65
+
66
+
67
+
68
+
## Coding Style
69
+
TODO: Define this
70
+
71
+
72
+
73
+
## Best Practices
74
+
75
+
This section captures some best practices for contributing code to torchchat. Following these will make PR reviews easier.
76
+
77
+
-**Modular Blocks instead of Monolithic Classes**. Stuffing all of the logic into a single class limits readability and makes it hard to reuse logic. Think about breaking the implementation into self-contained blocks which can be used independently from a given model. For example, attention mechanisms, embedding classes, transformer layers etc.
78
+
-**Say no to Implementation Inheritance**. You really don’t need it AND it makes the code much harder to understand or refactor since the logic is spread across many files/classes. Where needed, consider using Protocols.
79
+
-**Clean Interfaces**. There’s nothing more challenging than reading through functions/constructors with ~100 parameters. Think carefully about what needs to be exposed to the user and don’t hesitate to hard-code parameters until there is a need to make them configurable.
80
+
-**Intrusive Configs**. Config objects should not intrude into the class implementation. Configs should interact with these classes through cleanly defined builder functions which convert the config into flat parameters needed to instantiate an object.
81
+
-**Limit Generalization**. Attempting to generalize code before this is needed unnecessarily complicates implementations - you are anticipating use cases you don’t know a lot about. When you actually need to generalize a component, think about whether it’s worth it to complicate a given interface to stuff in more functionality. Don’t be afraid of code duplication if it makes things easier to read.
82
+
-**Value Checks and Asserts**. Don’t check values in higher level modules - defer the checks to the modules where the values are actually used. This helps reduce the number of raise statements in code which generally hurts readability, but are critical for correctness.
83
+
84
+
85
+
86
+
## Issues
87
+
We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue.
88
+
89
+
Meta has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. In those cases, please go through the process outlined on that page and do not file a public issue.
90
+
91
+
92
+
93
+
## License
94
+
By contributing to torchchat, you agree that your contributions will be licensed under the LICENSE file in the root directory of this source tree.
95
+
96
+
97
+
98
+
## Contributor License Agreement ("CLA")
99
+
In order to accept your pull request, we need you to submit a CLA. You only need to do this once to work on any of Meta's open source projects.
100
+
101
+
Complete your CLA here: <https://code.facebook.com/cla>
0 commit comments