{"id":25971816,"url":"https://github.com/mindspore-lab/mindnlp","last_synced_at":"2026-03-09T16:13:58.872Z","repository":{"id":59977020,"uuid":"540357453","full_name":"mindspore-lab/mindnlp","owner":"mindspore-lab","description":"MindSpore +  🤗Huggingface: Run any Transformers/Diffusers model on MindSpore with seamless compatibility and acceleration.","archived":false,"fork":false,"pushed_at":"2026-03-01T17:20:49.000Z","size":101206,"stargazers_count":910,"open_issues_count":63,"forks_count":265,"subscribers_count":11,"default_branch":"master","last_synced_at":"2026-03-01T18:17:28.040Z","etag":null,"topics":["deep-learning","diffusion-models","huggingface","large-language-models","llm","mindspore","natural-language-processing","nlp","nlp-library","python","vlm"],"latest_commit_sha":null,"homepage":"http://mindnlp.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mindspore-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2022-09-23T08:57:12.000Z","updated_at":"2026-03-01T17:20:54.000Z","dependencies_parsed_at":"2023-11-12T12:24:01.330Z","dependency_job_id":"ff4f0aa6-4245-430c-aba3-fad0d720a97b","html_url":"https://github.com/mindspore-lab/mindnlp","commit_stats":null,"previous_names":["mindlab-ai/mindnlp","mindspore-lab/mindhf","mindspore-lab/mindnlp"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/mindspore-lab/mindnlp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindspore-lab%2Fmindnlp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindspore-lab%2Fmindnlp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindspore-lab%2Fmindnlp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindspore-lab%2Fmindnlp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mindspore-lab","download_url":"https://codeload.github.com/mindspore-lab/mindnlp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindspore-lab%2Fmindnlp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30301848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T14:33:48.460Z","status":"ssl_error","status_checked_at":"2026-03-09T14:33:48.027Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","diffusion-models","huggingface","large-language-models","llm","mindspore","natural-language-processing","nlp","nlp-library","python","vlm"],"created_at":"2025-03-05T00:02:00.954Z","updated_at":"2026-03-09T16:13:58.858Z","avatar_url":"https://github.com/mindspore-lab.png","language":"Python","funding_links":[],"categories":["Industry Strength Natural Language Processing"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/mindspore-lab/mindnlp/master/assets/mindnlp_logo.png\" width=\"400\" alt=\"MindNLP Logo\"/\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eMindNLP\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eRun HuggingFace Models on MindSpore with Zero Code Changes\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cem\u003eThe easiest way to use 200,000+ HuggingFace models on Ascend NPU, GPU, and CPU\u003c/em\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/mindspore-lab/mindnlp/stargazers\"\u003e\n    \u003cimg alt=\"GitHub stars\" src=\"https://img.shields.io/github/stars/mindspore-lab/mindnlp?style=for-the-badge\u0026logo=github\u0026color=yellow\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pypi.org/project/mindnlp/\"\u003e\n    \u003cimg alt=\"PyPI Downloads\" src=\"https://img.shields.io/pypi/dm/mindnlp?style=for-the-badge\u0026logo=pypi\u0026color=blue\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/mindspore-lab/mindnlp/blob/master/LICENSE\"\u003e\n    \u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/mindspore-lab/mindnlp?style=for-the-badge\u0026color=green\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://mindnlp.cqu.ai/en/latest/\"\u003e\n    \u003cimg alt=\"Documentation\" src=\"https://img.shields.io/badge/docs-latest-blue?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/mindspore-lab/mindnlp/actions\"\u003e\n    \u003cimg alt=\"CI\" src=\"https://img.shields.io/github/actions/workflow/status/mindspore-lab/mindnlp/ci_pipeline.yaml?style=flat-square\u0026label=CI\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/mindspore-lab/mindnlp/pulls\"\u003e\n    \u003cimg alt=\"PRs Welcome\" src=\"https://img.shields.io/badge/PRs-welcome-brightgreen?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/mindspore-lab/mindnlp/issues\"\u003e\n    \u003cimg alt=\"Issues\" src=\"https://img.shields.io/github/issues/mindspore-lab/mindnlp?style=flat-square\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#-quick-start\"\u003eQuick Start\u003c/a\u003e •\n  \u003ca href=\"#-features\"\u003eFeatures\u003c/a\u003e •\n  \u003ca href=\"#-installation\"\u003eInstallation\u003c/a\u003e •\n  \u003ca href=\"#-why-mindnlp\"\u003eWhy MindNLP\u003c/a\u003e •\n  \u003ca href=\"https://mindnlp.cqu.ai\"\u003eDocumentation\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## 🎯 What is MindNLP?\n\n**MindNLP** bridges the gap between HuggingFace's massive model ecosystem and MindSpore's hardware acceleration. With just `import mindnlp`, you can run any HuggingFace model on **Ascend NPU**, **NVIDIA GPU**, or **CPU** - no code changes required.\n\n```python\nimport mindnlp  # That's it! HuggingFace now runs on MindSpore\nfrom transformers import pipeline\n\npipe = pipeline(\"text-generation\", model=\"Qwen/Qwen2-0.5B\")\nprint(pipe(\"Hello, I am\")[0][\"generated_text\"])\n```\n\n## ⚡ Quick Start\n\n### Text Generation with LLMs\n\n```python\nimport mindspore\nimport mindnlp\nfrom transformers import pipeline\n\npipe = pipeline(\n    \"text-generation\",\n    model=\"Qwen/Qwen3-8B\",\n    ms_dtype=mindspore.bfloat16,\n    device_map=\"auto\"\n)\n\nmessages = [{\"role\": \"user\", \"content\": \"Write a haiku about coding\"}]\nprint(pipe(messages, max_new_tokens=100)[0][\"generated_text\"][-1][\"content\"])\n```\n\n### Image Generation with Stable Diffusion\n\n```python\nimport mindspore\nimport mindnlp\nfrom diffusers import DiffusionPipeline\n\npipe = DiffusionPipeline.from_pretrained(\n    \"stable-diffusion-v1-5/stable-diffusion-v1-5\",\n    ms_dtype=mindspore.float16\n)\nimage = pipe(\"A sunset over mountains, oil painting style\").images[0]\nimage.save(\"sunset.png\")\n```\n\n### BERT for Text Classification\n\n```python\nimport mindnlp\nfrom transformers import AutoTokenizer, AutoModelForSequenceClassification\n\ntokenizer = AutoTokenizer.from_pretrained(\"bert-base-uncased\")\nmodel = AutoModelForSequenceClassification.from_pretrained(\"bert-base-uncased\")\n\ninputs = tokenizer(\"MindNLP is awesome!\", return_tensors=\"pt\")\noutputs = model(**inputs)\n```\n\n## ✨ Features\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"50%\"\u003e\n\n### 🤗 Full HuggingFace Compatibility\n\n- **200,000+ models** from HuggingFace Hub\n- **Transformers** - All model architectures\n- **Diffusers** - Stable Diffusion, SDXL, ControlNet\n- **Zero code changes** - Just `import mindnlp`\n\n\u003c/td\u003e\n\u003ctd width=\"50%\"\u003e\n\n### 🚀 Hardware Acceleration\n\n- **Ascend NPU** - Full support for Huawei AI chips\n- **NVIDIA GPU** - CUDA acceleration\n- **CPU** - Optimized CPU execution\n- **Multi-device** - Automatic device placement\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd width=\"50%\"\u003e\n\n### 🔧 Advanced Capabilities\n\n- **Mixed precision** - FP16/BF16 training \u0026 inference\n- **Quantization** - INT8/INT4 with BitsAndBytes\n- **Distributed** - Multi-GPU/NPU training\n- **PEFT/LoRA** - Parameter-efficient fine-tuning\n\n\u003c/td\u003e\n\u003ctd width=\"50%\"\u003e\n\n### 📦 Easy Integration\n\n- **PyTorch-compatible API** via mindtorch\n- **Safetensors** support for fast loading\n- **Model Hub mirrors** for faster downloads\n- **Comprehensive documentation**\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## 🧪 Mindtorch NPU Debugging\n\nMindtorch NPU ops are async by default. Use `torch.npu.synchronize()` when you need to block on results.\nFor debugging, set `ACL_LAUNCH_BLOCKING=1` to force per-op synchronization.\n\n## 📦 Installation\n\n```bash\n# From PyPI (recommended)\npip install mindnlp\n\n# From source (latest features)\npip install git+https://github.com/mindspore-lab/mindnlp.git\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e📋 Version Compatibility\u003c/b\u003e\u003c/summary\u003e\n\n| MindNLP | MindSpore | Python |\n|---------|-----------|--------|\n| 0.6.x   | ≥2.7.1    | 3.10-3.11 |\n| 0.5.x   | 2.5.0-2.7.0 | 3.10-3.11 |\n| 0.4.x   | 2.2.x-2.5.0 | 3.9-3.11 |\n\n\u003c/details\u003e\n\n## 💡 Why MindNLP?\n\n| Feature | MindNLP | PyTorch + HF | TensorFlow + HF |\n|---------|---------|--------------|-----------------|\n| HuggingFace Models | ✅ 200K+ | ✅ 200K+ | ⚠️ Limited |\n| Ascend NPU Support | ✅ Native | ❌ | ❌ |\n| Zero Code Migration | ✅ | - | ❌ |\n| Unified API | ✅ | ✅ | ❌ |\n| Chinese Model Support | ✅ Excellent | ✅ Good | ⚠️ Limited |\n\n### 🏆 Key Advantages\n\n1. **Instant Migration**: Your existing HuggingFace code works immediately\n2. **Ascend Optimization**: Native support for Huawei NPU hardware\n3. **Production Ready**: Battle-tested in enterprise deployments\n4. **Active Community**: Regular updates and responsive support\n\n## 🗺️ Supported Models\n\nMindNLP supports **all models** from HuggingFace Transformers and Diffusers. Here are some popular ones:\n\n| Category | Models |\n|----------|--------|\n| **LLMs** | Qwen, Llama, ChatGLM, Mistral, Phi, Gemma, BLOOM, Falcon |\n| **Vision** | ViT, CLIP, Swin, ConvNeXt, SAM, BLIP |\n| **Audio** | Whisper, Wav2Vec2, HuBERT, MusicGen |\n| **Diffusion** | Stable Diffusion, SDXL, ControlNet |\n| **Multimodal** | LLaVA, Qwen-VL, ALIGN |\n\n👉 [View all supported models](https://mindnlp.cqu.ai/supported_models)\n\n## 📚 Resources\n\n- 📖 [Documentation](https://mindnlp.cqu.ai)\n- 🚀 [Quick Start Guide](https://mindnlp.cqu.ai/quick_start)\n- 📝 [Tutorials](https://mindnlp.cqu.ai/tutorials/quick_start)\n- 💬 [GitHub Discussions](https://github.com/mindspore-lab/mindnlp/discussions)\n- 🐛 [Issue Tracker](https://github.com/mindspore-lab/mindnlp/issues)\n\n## 🤝 Contributing\n\nWe welcome contributions! See our [Contributing Guide](https://mindnlp.cqu.ai/contribute) for details.\n\n```bash\n# Clone and install for development\ngit clone https://github.com/mindspore-lab/mindnlp.git\ncd mindnlp\npip install -e \".[dev]\"\n```\n\n## 👥 Community\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/mindspore-lab/mindnlp/graphs/contributors\"\u003e\n    \u003cimg src=\"https://contrib.rocks/image?repo=mindspore-lab/mindnlp\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nJoin the **MindSpore NLP SIG** (Special Interest Group) for discussions, events, and collaboration:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/qrcode_qq_group.jpg\" width=\"200\" alt=\"QQ Group\"/\u003e\n\u003c/p\u003e\n\n## ⭐ Star History\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://star-history.com/#mindspore-lab/mindnlp\u0026Date\"\u003e\n    \u003cimg src=\"https://api.star-history.com/svg?repos=mindspore-lab/mindnlp\u0026type=Date\" alt=\"Star History Chart\" width=\"600\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n**If you find MindNLP useful, please consider giving it a star ⭐ - it helps the project grow!**\n\n## 📄 License\n\nMindNLP is released under the [Apache 2.0 License](LICENSE).\n\n## 📖 Citation\n\n```bibtex\n@misc{mindnlp2022,\n    title={MindNLP: Easy-to-use and High-performance NLP and LLM Framework Based on MindSpore},\n    author={MindNLP Contributors},\n    howpublished={\\url{https://github.com/mindspore-lab/mindnlp}},\n    year={2022}\n}\n```\n\n---\n\n\u003cp align=\"center\"\u003e\n  Made with ❤️ by the \u003ca href=\"https://github.com/mindspore-lab\"\u003eMindSpore Lab\u003c/a\u003e team\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindspore-lab%2Fmindnlp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmindspore-lab%2Fmindnlp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindspore-lab%2Fmindnlp/lists"}