Networks form the backbone of a wide variety of complex systems, ranging from food webs, gene regulation, social networks, transportation and the internet. However, due to the sheer size and complexity of many of theses systems, it remains an open challenge to formulate general descriptions of their structures, and to extract such information from data. Since networks are high-dimensional relational objects, they cannot be directly inspected using basic tools, and instead require new methodology. In this talk, I present a Bayesian formulation of weighted stochastic block models that can be used to infer the large-scale modular structure of weighted networks, including their hierarchical organization. Our method is nonparametric, and thus does not require the prior knowledge of the number of modules or other dimensions of the model, which are instead inferred from data. We give a comprehensive treatment of different kinds of edge weights (i.e. continuous or discrete, signed or unsigned, bounded or unbounded), as well as arbitrary weight transformations, and describe an unsupervised model selection approach to choose the best network description. We illustrate the application of our method to a variety of empirical weighted networks, such as global migrations, voting patterns in congress, and neural connections in the human brain.