teleren/devto huggingface dataset:
Run MusicGen on Google Colab/Windows11
Tags: python, generativeai, deeplearning, windows
Published: 2023-06-11 15:59:42

## What is MusicGen
> Audiocraft is a library for audio processing and generation with deep learning. It features the state-of-the-art EnCodec audio compressor / tokenizer, along with MusicGen, a simple and controllable music generation LM with textual and melodic conditioning.

Meta's open source AI MusicGen turns text and melody into new songs
https://the-decoder.com/metas-open-source-ai-musicgen-turns-text-and-melody-into-new-songs/



{% twitter 1667554997121302530 %}


- Github: https://github.com/facebookresearch/audiocraft
- HuggingFace: https://huggingface.co/spaces/facebook/MusicGen
- Paper: https://arxiv.org/abs/2306.05284


# Steps for Colab
1. Go to Google Colab
2. Change Runtime
3. Run code
4. Try to generate sound

## step 1. Go to Google Colab
https://colab.research.google.com/

## step 2. Change Runtime
Click `Runtime` and select `GPU`


![Google Colab Runtime](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r9h2j3ci589uqqxnrpi7.png)

## step 3. Run code

```py
!git clone -b dev https://github.com/camenduru/MusicGen-hf
cd MusicGen-hf/
!pip install -r requirements.txt
!python app.py
```

Installing python packages will take some time.
If everything works properly, you will see something like this.

![Google Colab output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a6jhfphhkpddsi9kubxg.png)

## step4. Try to generate sound
If you click the link `Running on public URL:`, you will see Gardio.


![Gardio](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62zbvsqikaoza6ptla3z.png)

Now time to create your own sound via prompt!
It would take around 1-2 minutes to generate a mp4 file. 


# Steps for Windows11
You need to install cuda11.7 on your Windows11.
1. Create a venv
2. Install pytorch
3. Clone repo and install requirements
4. Try to generate sound


## step 1. Create a venv

```shell
python -m venv musicgen
# activate venv
./musicgen/scripts/activate
```

## step 2. Install pytorch 
This step will take some time.

```shell
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
```

## step 3. Clone repo and install requirements
```shell
git clone https://github.com/facebookresearch/audiocraft.git
cd audiocraft
pip install -e .
```

## step 4. Try to generate sound
As Google Colab, we will run web ui with the following command.
```shell
python app.py
```
You're using && and || incorrectly
Tags: javascript, logicaloperators
Published: 2023-06-11 15:53:00

---
title: You're using && and || incorrectly
published: true
description: JS has 2 logical operators, && and || which are typically used for comparisons. However, they do not always return Boolean and depending on how you use them, that could cause problems
tags: #JS #JavaScript #logicalOperators
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-06-11 13:27 +0000
---
##Let's look at some expressions

 ```const a = 1 || 0 // a = 1
 const b = 0 || 2 || 1 // b = 2
 const c = 0 || false || null || '' // c = ''
 const d = 1 && 2 && 3 // d = 3
 const e = 2 && "" && 3 // e = ""```

If you evaluated all of these expressions correctly, then congratulations! You do need this article, go forth ye wise developer. However, if you're confused why these expressions didn't evaluate to a Boolean value, read on!

These operators evaluate and return the logical value when evaluated from left to right. This returned value is always one of the operands so if the operators are used on non-boolen values, it will return a non-boolean value

JavaScript has 6 falsy values -

1. `false`
2. `0`
3. `""` or `''`
4. `null`
5. `undefined`
6. `NaN`

If a value is not falsy, it's truthy

The `||` operator returns the first truthy value and if none are truthy, it returns the last value (which is falsy)

The `&&` operator returns the first falsy value and if none are falsy, it returns the last value (which is truthy)

With this perspective, go through the expressions above and see if you get the right answers this time :)

##How can you use this?

When you use these operators, be sure that the operands used are actually boolean values to avoid truthy/ falsy values. 

While you could use them inside an `if()` `while()` or a `?:` this is still risky, if your operands are not boolean. However, the bigger problem arises when they are evaluated into a variable.

For example, `[]` or `{}` are truthy values even though they are empty. So,

```const m = [1,2,3,4,5]
const n = m.filter(i => i > 100) // n = []
const o = n.length // o = 0
const p = (n && o) // p = 0 ```

Here if `p` is used in an if() or a ?: it will evaluate to falsy but if you use `p` with the assumption that it's is a Boolean somewhere else, Ex: `typeof y === 'boolean'` that will be `false`

A very simple fix is using `Boolean()` Ex:
`const q = Boolean(n && o) // q = false `

##Conclusion

* `&&` and `||` are logical operators which return one of the operands, not necessarily a boolean value
* Be careful to avoid truthy/ falsy values when evaluating expressions with  `&&` or `||`
* Wrap your expressions inside a `Boolean()` to always return a boolean result

Enjoy this article? Follow me to read more interesting articles on JS, React and more!
Generate SBOM
Tags: sbom, github, dotnet, 100daystooffload
Published: 2023-06-11 15:06:38

Perhaps the easiest way to generate a SBOM file is to use GitHub which relative recently added that as feature, [Introducing self-service SBOMs](https://github.blog/2023-03-28-introducing-self-service-sboms/).

This feature can be found at the __Dependency graph__ section which is located in the __Insights__-tab of your project. In that view there is a button to export a SBOM file in the SPDX format.

However if you don't use GitHub then there is a lot of other tools to use, maybe this link, [awesome-sbom](https://github.com/awesomeSBOM/awesome-sbom), can be a good start.

If you have a dotnet project then you can use the [_sbom-tool_](https://github.com/microsoft/sbom-tool) from Microsoft like this:

```bash
# Go to the root of your project
dotnet tool install Microsoft.Sbom.DotNetTool
```

Which will add the tool to the tools config file of your project.

```bash
# Will output some help on how to use the tool
dotnet tool run sbom-tool
```
AWQ: A Revolutionary Approach to Quantization for Large Language Model Compression and Acceleration
Tags: yogyaopensource, ai, llm, datascience
Published: 2023-06-11 14:33:52

Hello Dev Community! 👋

Today, I'm thrilled to introduce you to an innovative project that's pushing the boundaries of machine learning and artificial intelligence - [AWQ](https://github.com/mit-han-lab/llm-awq). Developed by the MIT Han Lab, AWQ stands for Activation-aware Weight Quantization, a technique designed for efficient and accurate low-bit weight quantization for Large Language Models (LLMs).

## What is AWQ? 🤔

AWQ is a Python-based project that presents a novel approach to quantization, specifically designed for LLMs. It supports instruction-tuned models and multi-modal Language Models (LMs), providing a powerful tool for LLM compression and acceleration.

Quantization is a technique used to reduce the computational and memory demands of machine learning models, making them more efficient for deployment on hardware with limited resources. AWQ takes this a step further by introducing activation-aware weight quantization, which allows for more accurate and efficient quantization.

## Key Features of AWQ 🚀

- **AWQ Search**: AWQ provides a search function for accurate quantization, ensuring optimal performance.

- **Pre-computed AWQ Model Zoo**: The project includes pre-computed AWQ search results for multiple model families, including [LLaMA](https://ai.facebook.com/blog/large-language-model-llama-meta-ai/), OPT, [Vicuna](https://lmsys.org/blog/2023-03-30-vicuna/), and [LLaVA](https://github.com/haotian-liu/LLaVA).

- **Memory-Efficient 4-bit Linear in [PyTorch](https://pytorch.org/)**: AWQ includes a memory-efficient 4-bit Linear implementation in PyTorch, further enhancing its efficiency.

- **Efficient CUDA Kernel Implementation**: The project includes an efficient CUDA kernel implementation for fast inference, supporting both the context and decoding stage.

## Getting Started with AWQ 🛠️

To get started with AWQ, you'll need to clone the repository and install the necessary dependencies. The project provides detailed installation instructions, including how to install the efficient W4A16 (4-bit weight, 16-bit activation) CUDA kernel.

Once you've set everything up, you can start exploring the AWQ Model Zoo and running examples of AWQ application, such as Vicuna-7B (chatbot) and LLaVA-13B (visual reasoning).

## Wrapping Up 🎁

AWQ is a groundbreaking project for anyone interested in the field of machine learning model quantization. Its innovative approach to activation-aware weight quantization opens up new possibilities for efficient AI deployment. So, don't wait! Head over to the AWQ GitHub repository and start exploring!
Exploring TermGPT: A Powerful Tool for Terminal-based Interactions with GPT
Tags: openai, yogyaopensource, ai, gpt3
Published: 2023-06-11 14:19:12

Today, I want to introduce you to an exciting project I recently stumbled upon - [TermGPT](https://github.com/Sentdex/TermGPT). This Python-based project leverages the power of OpenAI's GPT models and brings it to your terminal, enabling a whole new level of interaction!

## What is TermGPT? 🤔
TermGPT is a Python project that allows you to interact with GPT models directly from your terminal. It's a fantastic tool for developers who want to experiment with GPT models without the need for a GUI or a web interface.

## Key Features of TermGPT 🚀
- **Terminal-based Interaction**: TermGPT is designed to work directly from your terminal, making it a lightweight and efficient tool for developers.

- **Powered by GPT Models**: The project leverages the power of OpenAI's GPT models, bringing the capabilities of one of the most advanced language models to your terminal.

- **Easy to Use**: With a well-documented README.md and an explanatory Jupyter notebook [TermGPT-explained](https://github.com/Sentdex/TermGPT/blob/main/TermGPT-explained.ipynb), getting started with TermGPT is a breeze.

## Getting Started with TermGPT 🛠️

To get started with TermGPT, you'll need to clone the repository and install the necessary dependencies listed in the requirement.txt file. The project also provides an .env.example file to guide you in setting up any necessary environment variables.

Once you've set up everything, you can start interacting with the GPT models directly from your terminal!

## Wrapping Up 🎁
TermGPT is a fantastic tool for developers interested in experimenting with GPT models. Its terminal-based interaction makes it a lightweight and efficient tool, and its well-documented resources make it easy to get started.

So, what are you waiting for? Head over to the TermGPT GitHub repository and start exploring!
How to fix "Cannot find module 'node-darwin-arm64/package.json"
Tags: reactnative, objectivec, m1, xcode
Published: 2023-06-11 13:58:27

These issues were commonly occurring in M1 chip users. This can be noticed after taking the clone of the project and while doing npm install.

```
Cannot find module 'node-darwin-arm64/package.json'
```
This is due to an architecture mismatch happening while installing dependencies in the system. Darwin is one of the main dependencies which will create the node folder, which is key for other dependencies to install.

To resolve the issue, install NVM (Node Version Manager) to continue installing the Node dependencies with the arch flag.
Please nvm installation guide for easy implementation.

Run **nvm ls** command to verify the dependencies installed properly. And it looks as below,


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ttpliicfxzt38zsadcaf.png)

Now check the arch flag in the terminal using command **arch** in terminal. By default it will be arm64.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/in12ahdog1t3ztq70p9s.png)

For M1 user, npm needs to install with i386 arch flags to avoid the darwin dependency issue error. Do uninstall the existing node version using the below command.

`nvm uninstall 14.21.3 //uninstall the respective node versions `

To install the node with arch flag, enter the below command to execute 

```
arch -x86_64 zsh 
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w2ojmynxclqbjpm2jhxx.png)

Now the arch reference is pointed to i386, and make sure not to kill the terminal because this flag will remain until we terminate the terminal. To install Node with NVM, use the following command.

```
nvm install 14.21.3
nvm alias default 14.21.3

```
After all these executions, try running npm install, and now you could see in the terminal that the darwin dependency is created successfully.

Thanks for Reading, Do comment if any queries.
Happy Coding...
Common squares
Tags: perl, python, theweeklychallenge
Published: 2023-06-11 13:47:58

## Weekly Challenge 220

This is the second consecutive week I've done the task and written the blog 40,000+ feet in the air.

[Challenge](https://theweeklychallenge.org/blog/perl-weekly-challenge-220/), [My solution](https://github.com/manwar/perlweeklychallenge-club/tree/master/challenge-220/sgreen)

## Task 1: Common Characters

### Task

You are given a list of words.

Write a script to return the list of common characters (sorted alphabetically) found in every word of the given list.

### My solution

These are the steps I took.

1. From a list (array in Perl) of `words`, I create a list called `set_list`. Each item is a set (hash in Perl) of the lower case letters that occur in each word. In Python this is achieved using `set(word)` as strings are an iterable. In Perl I have a function called `word_to_hash` as it seemed like a bit too much to stuff into a single map statement.
1. I take off the first word from the `set_list` and assign it to the `first_word` variable.
1. I loop through each letter in the first word alphabetically.
1. I check that the letter is indeed a letter from the English alphabet and that it appears in all the words in the `set_list` list. If it is, I append it to the `letters` list.
1. Finally, I print items in the letters list.

### Examples

```bash
$ ./ch-1.py Perl Raku Rust
r

$ ./ch-1.py love live leave
e, l, v
```

## Task 2: Squareful

### Task

You are given an array of integers, `@ints`.

An array is squareful if the sum of every pair of adjacent elements is a perfect square.

Write a script to find all the permutations of the given array that are squareful.

### My solution

Rather than reinventing some perfectly good wheels, I use the permutation function from Python's [itertools](https://docs.python.org/3/library/itertools.html) and Perl's [Algorithm::Combinatorics](https://metacpan.org/pod/Algorithm::Combinatorics) to work through all possible permutations. If we already have a solution with these numbers (e.g. a duplicate number), we skip to the next permutation.

I then have an inner loop from 1 to one less than the number of integers we have. I check that the value at that position and the previous position makes up a perfect square. This is done by calculating the square root of the sum of the two numbers, and checking it is equals to an integer.

### Examples

```bash
$ ./ch-2.py 1 17 8
(1, 8, 17), (17, 8, 1)

$ ./ch-2.py 2 2 2
(2, 2, 2)
```
Vocabulary Building Day 25
Published: 2023-06-11 13:45:06

1. **insipid**(adjective):lacking taste or flavour.
![alt text](https://www.wineverygame.com/words/images/insipid.jpg)
[Checkout Pronunciation](https://www.google.com/search?q=insipid&rlz=1C5CHFA_enIN1061IN1061&oq=ins&aqs=chrome.0.69i59l2j69i57j0i131i433i512l2j0i512j46i199i465i512j0i131i433i512j46i199i465i512j0i131i433i512.3064j1j9&sourceid=chrome&ie=UTF-8)
Sentence:  Are you feeling whatever food we are eating is hostel is insipid.

2. **pragmatic**(adjective): concerned with the practical matters.
![alt text](https://cdn3.invitereferrals.com/blog/wp-content/uploads/2020/08/28084547/Pragmatic-marketing-Objectives-and-basic-approach-min.jpg)
[Checkout Pronunciation](https://www.google.com/search?q=pragmatic&rlz=1C5CHFA_enIN1061IN1061&oq=pragmatic&aqs=chrome.0.69i59j0i131i433i512j0i512j46i131i199i433i465i512j0i131i433i512l2j0i512j46i340i512l2j0i131i433i512.3817j0j9&sourceid=chrome&ie=UTF-8)
He proposed a pragmatic approach

3. **arduous**(adjective): difficult to accomplish
![alt text](https://pbs.twimg.com/media/D8Msw1dX4AALyth.jpg)
[Checkout Pronunciation](https://www.google.com/search?q=arduous&rlz=1C5CHFA_enIN1061IN1061&oq=arduous&aqs=chrome..69i57j0i433i512j0i512j0i433i512j0i20i263i512j0i512l5.2538j0j9&sourceid=chrome&ie=UTF-8)
Getting good score in GRE is arduous Process.

4. **prosaic**(adjective): not challenging, dull and lacking excitement
![alt text](https://thumbs.dreamstime.com/b/common-people-7222739.jpg)
[Checkout Pronunciation](https://www.google.com/search?q=prosaic&rlz=1C5CHFA_enIN1061IN1061&oq=prosaic&aqs=chrome..69i57j0i433i512j0i512l2j0i20i263i512j0i512l4j46i175i199i512.2485j1j9&sourceid=chrome&ie=UTF-8)
Some kids will become prosaic when they don’t understand few things in school.

5. **ameliorate**(adjective): become better, make
![alt text](https://www.wineverygame.com/words/images/ameliorate.jpg)
[Checkout Pronunciation](https://www.google.com/search?q=ameliorate&rlz=1C5CHFA_enIN1061IN1061&oq=Ameliorate&aqs=chrome.0.69i59j0i433i512j0i512j0i433i512j0i512j0i20i263i512j0i512j46i175i199i512j0i512l2.4380j1j9&sourceid=chrome&ie=UTF-8)
Doctors will make our life ameliorate.

I hope this helps you if you are preparing for GRE exams.
AsmBB v3.0 has been released.
Tags: webdev, asm, socialmedia, opensource
Published: 2023-06-11 13:31:24

AsmBB is very fast and lightweight web forum engine.

AsmBB is fully written in assembly language and uses SQLite as a database back-end. That is why it can work on really weak hosting and in the same time serve huge amount of visitors without lags and delays.

AsmBB is very secure web application, because of the internal design and the reduced dependencies. But it also supports encrypted databases, for even higher security. 

There are mainly security updates in this release. 

Read the details (and test the engine):[https://board.asm32.info/asmbb-v3-0-has-been-released.401/](https://board.asm32.info/asmbb-v3-0-has-been-released.401/)
fix screen tearing linux
Published: 2023-06-11 13:19:38

sudo mkdir -p /etc/X11/xorg.conf.d

sudo vim /etc/X11/xorg.conf.d/20-intel.conf

```
Section "Device"
   Identifier "Intel Graphics"
   Driver "intel"
   Option "TearFree" "true"
   Option "AccelMethod"  "sna"
   Option "DRI" "3"
 EndSection

```

- Koristi 'intel' kao driver
- 
```
Option "AccelMethod"  "sna"
   Option "DRI" "3"
```
I ne moraš samo treba ovaj `Option "TearFree" "true"`



-------------------------

There are many ways to check what driver is in use on your system:

sudo lspci -k | grep -EA3 'VGA|3D|Display'

grep "LoadModule" /var/log/Xorg.0.log

Alternatively, you can also check using the inxi command:

inxi -G
Graphics:
  Device-1: Intel Haswell-ULT Integrated Graphics driver: i915 v: kernel
  Display: x11 server: X.Org 1.20.8 driver: i915 resolution: 1366x768~60Hz
  OpenGL: renderer: Mesa DRI Intel HD Graphics 4400 (HSW GT2)
  v: 4.5 Mesa 20.0.4



-----------------------------

https://www.dedoimedo.com/computers/linux-intel-graphics-video-tearing.html

https://christitus.com/fix-screen-tearing-linux/
Content & Tooling Team Status Update
Tags: puppet, community
Published: 2023-06-16 16:01:43

---
title: Content & Tooling Team Status Update
published: true
date: 2023-06-09 00:00:00 UTC
tags: puppet, community
canonical_url: https://puppetlabs.github.io/content-and-tooling-team/blog/updates/2023-06-09-status-update/
---

# Happy Sunny Friday!

It’s Friday and the sun is shining in Belfast! We don’t get a lot of sun up here so a sunny day is something to celebrate. Hopefully wherever you are it’s sunny and you’re finishing up another week of work. We’ve been busy as usual this week in the CAT team and are very much looking forward to our second half day Friday. Here are our updates for the week.

## We have a new team member joining us!

Some very exciting news… we have a new team member joining us in Pune! This will be the third new addition in our Pune office. We are very excited to see our team grow and what extra value we can deliver in the future!

## LVM module

As mentioned last week, we now have a module which provides Logical Volume Management (LVM) support for Puppet thanks to [Jordan](https://github.com/jordanbreen28). This week [Jordan](https://github.com/jordanbreen28) has continued to work on this to ensure the module is in good condition and ready to go. You can check out [puppetlabs-lvm](https://forge.puppet.com/modules/puppetlabs/lvm) on the forge.

## Upgrades to our testing infrastructure

[Sencha](https://github.com/Ramesh7) has been making performance improvements to our testing infrastructure. This has been a big win for us as we are now seeing less CI failures which means we are wasting less time debugging. Nice job [Sencha](https://github.com/Ramesh7)!

## Ongoing Stdlib work

Regarding the follow on work from adding Puppet 8 support to our Stdlib module, [Lukas](https://github.com/LukasAud) has made a round of Stdlib dependencies have been bumped all over our supported modules so you can expect a few releases next week in relation to this.

## Community Contributions

We’d like to thank the following people in the Puppet Community for their contributions over this past week:

- [`puppetlabs-apt#1114`](https://github.com/puppetlabs/puppetlabs-apt/pull/1114): “Require stdlib 9.0.0 or newer”, thanks to [smortex](https://github.com/smortex)
- [`puppetlabs-apt#1113`](https://github.com/puppetlabs/puppetlabs-apt/pull/1113): “(CONT-1028) puppetlabs/stdlib: Allow 9.x”, thanks to [bastelfreak](https://github.com/bastelfreak)
- [`puppetlabs-kubernetes#631`](https://github.com/puppetlabs/puppetlabs-kubernetes/pull/631): “Make cgroup\_driver default to systemd”, thanks to [r-tierney](https://github.com/r-tierney)
- [`puppetlabs-vcsrepo#586`](https://github.com/puppetlabs/puppetlabs-vcsrepo/pull/586): “Add classes to manage supported SCM packages”, thanks to [jcpunk](https://github.com/jcpunk) and the following people who helped get it over the line ([ekohl](https://github.com/ekohl))

## New Module / Gem Releases

The following modules were released this week:

- [`puppetlabs-kubernetes`](https://github.com/puppetlabs/puppetlabs-kubernetes) (`8.0.0`)